1 /* BLURB lgpl
2 
3                            Coda File System
4                               Release 5
5 
6           Copyright (c) 1987-1999 Carnegie Mellon University
7                   Additional copyrights listed below
8 
9 This  code  is  distributed "AS IS" without warranty of any kind under
10 the  terms of the  GNU  Library General Public Licence  Version 2,  as
11 shown in the file LICENSE. The technical and financial contributors to
12 Coda are listed in the file CREDITS.
13 
14                         Additional copyrights
15                            none currently
16 
17 #*/
18 
19 /*
20 *
21 *                 Definitions for RVM Statistics Structures
22 *
23 */
24 /*LINTLIBRARY*/
25 
26 /* permit multiple includes */
27 #ifndef RVM_STATISTICS_VERSION
28 
29 #define RVM_STATISTICS_VERSION  "RVM Statistics Version 1.1 8 Dec 1992"
30 
31 #include <stdio.h>
32 
33 /* histgram definitions */
34 
35 #define flush_times_len         10      /* length of flush timing vectors */
36 #define flush_times_dist                /* timing distribution in millisecs */ \
37     25,50,100,250,500,1000,2500,5000,10000 /* use as array initializer */
38 
39 #define truncation_times_len    5       /* length of truncation timing vectors */
40 #define truncation_times_dist           /* timing distribution in seconds */ \
41     1,10,100,500
42 
43 #define range_lengths_len       13      /* length of range length histogram */
44 #define range_lengths_dist              /* range lengths in bytes */ \
45     0,4,8,16,32,64,128,256,512,1024,2048,4096
46 
47 #define range_overlaps_len      13      /* length of overlaps eliminated by
48                                            range coalesce */
49 #define range_overlaps_dist             /* range lengths in bytes */ \
50     0,4,8,16,32,64,128,256,512,1024,2048,4096
51 
52 #define trans_overlaps_len      13      /* length of overlaps eliminated by
53                                            transaction coalesce */
54 #define trans_overlaps_dist             /* range lengths in bytes */ \
55     0,4,8,16,32,64,128,256,512,1024,2048,4096
56 
57 #define range_elims_len          6      /* ranges eliminated from log by
58                                            range coalesce */
59 #define range_elims_dist                /* number of ranges */ \
60     0,5,10,50,100
61 
62 #define trans_elims_len          6      /* ranges eliminated from log by
63                                            trans coalesce */
64 #define trans_elims_dist                /* number of ranges */ \
65     0,5,10,50,100
66 
67 #define trans_coalesces_len     6       /* transactions coalesced by
68                                            trans coalesce */
69 #define trans_coalesces_dist            /* number of transactions */ \
70     0,5,10,50,100
71 /* RVM statistics record */
72 typedef struct
73     {
74     rvm_struct_id_t struct_id;          /* self-identifier, do not change */
75     rvm_bool_t      from_heap;          /* true if heap allocated;
76 					   do not change */
77 
78                                         /* transaction statistics --
79 					   current epoch */
80 
81     rvm_length_t    n_abort;            /* number of transactions aborted */
82     rvm_length_t    n_flush_commit;     /* number of flush mode commits */
83     rvm_length_t    n_no_flush_commit;  /* number of no_flush mode commits */
84     rvm_length_t    n_uncommit;         /* number of uncommited transactions */
85     rvm_length_t    n_no_flush;         /* number of queued no_flush transactions */
86     rvm_length_t    n_truncation_wait;  /* total transactions delayed by truncation */
87     rvm_offset_t    no_flush_length;    /* length of queued no_flush transactions */
88                                         /* log statistics -- current epoch */
89 
90     rvm_length_t    n_split;            /* number trans split for log wrap */
91     rvm_length_t    n_flush;            /* number of internal flushes */
92     rvm_length_t    n_rvm_flush;        /* number of explicit flush calls */
93     rvm_length_t    n_special;          /* number of special log records */
94     rvm_length_t    n_wrap;             /* number of log wrap-arounds (0 or 1) */
95     rvm_length_t    log_dev_cur;        /* current % log device in use */
96     rvm_offset_t    log_written;        /* current length of writes to log */
97     rvm_offset_t    range_overlap;      /* current overlap eliminated by range coalesce */
98     rvm_offset_t    trans_overlap;      /* current overlap eliminated by trans coalesce */
99     rvm_length_t    n_range_elim;       /* current number of ranges eliminated by
100                                            range coalesce/flush */
101     rvm_length_t    n_trans_elim;       /* current number of ranges eliminated by
102                                            trans coalesce/flush */
103     rvm_length_t    n_trans_coalesced;  /* number of transactions coalesced in
104                                            this flush cycle */
105     struct timeval  flush_time;         /* time spent in flushes */
106     rvm_length_t    last_flush_time;    /* duration of last flush (msec) */
107     rvm_length_t    last_truncation_time; /* duration of last truncation (sec) */
108     rvm_length_t    last_tree_build_time; /* duration of tree build (sec) */
109     rvm_length_t    last_tree_apply_time; /* duration of tree apply phase
110                                              (sec) */
111                                         /* histogram vectors */
112 
113     rvm_length_t    flush_times[flush_times_len]; /* flush timings (msec) */
114     rvm_length_t    range_lengths[range_lengths_len]; /* range lengths flushed */
115     rvm_length_t    range_elims[range_elims_len]; /* num ranges eliminated by
116                                                      range coalesce/flush */
117     rvm_length_t    trans_elims[trans_elims_len]; /* num ranges eliminated by
118                                                      trans coalesce/flush */
119     rvm_length_t    range_overlaps[range_overlaps_len]; /* space saved by
120                                                            range coalesce/flush */
121     rvm_length_t    trans_overlaps[range_overlaps_len]; /* space saved by
122                                                            trans coalesce/flush */
123                                         /* transaction stats -- cumulative since log init */
124 
125     rvm_length_t    tot_abort;          /* total aborted transactions */
126     rvm_length_t    tot_flush_commit;   /* total flush commits */
127     rvm_length_t    tot_no_flush_commit; /* total no_flush commits */
128 
129                                         /* log stats -- cumulative */
130 
131     rvm_length_t    tot_split;          /* total transactions split for log wrap-around */
132     rvm_length_t    tot_flush;          /* total internal flush calls  */
133     rvm_length_t    tot_rvm_flush;      /* total explicit rvm_flush calls  */
134     rvm_length_t    tot_special;        /* total special log records */
135     rvm_length_t    tot_wrap;           /* total log wrap-arounds */
136     rvm_length_t    log_dev_max;        /* maximum % log device used so far */
137     rvm_offset_t    tot_log_written;    /* total length of all writes to log */
138     rvm_offset_t    tot_range_overlap;  /* total overlap eliminated by range coalesce */
139     rvm_offset_t    tot_trans_overlap;  /* total overlap eliminated by trans coalesce */
140     rvm_length_t    tot_range_elim;     /* total number of ranges eliminated by
141                                            range coalesce */
142     rvm_length_t    tot_trans_elim;     /* total number of ranges eliminated by
143                                            trans coalesce */
144     rvm_length_t    tot_trans_coalesced; /* total number of transactions coalesced */
145 
146                                         /* truncation stats -- cummulative */
147 
148     rvm_length_t    tot_rvm_truncate;   /* total explicit rvm_truncate calls */
149     rvm_length_t    tot_async_truncation; /* total asynchronous truncations */
150     rvm_length_t    tot_sync_truncation; /* total forced synchronous truncations */
151     rvm_length_t    tot_truncation_wait; /* total transactions delayed by truncation */
152     rvm_length_t    tot_recovery;       /* total recovery truncations */
153     struct timeval  tot_flush_time;     /* total time spent in flush */
154     struct timeval  tot_truncation_time; /* cumulative truncation time */
155 
156                                         /* histogram vectors */
157                                         /* truncation timings (sec) */
158     rvm_length_t    tot_tree_build_times[truncation_times_len];
159     rvm_length_t    tot_tree_apply_times[truncation_times_len];
160     rvm_length_t    tot_truncation_times[truncation_times_len];
161                                         /* cummulative flush timings (msec) */
162     rvm_length_t    tot_flush_times[flush_times_len];
163                                         /* cummulative range lengths */
164     rvm_length_t    tot_range_lengths[range_lengths_len];
165                                         /* total num ranges eliminated by
166                                            range coalesce/flush */
167     rvm_length_t    tot_range_elims[range_elims_len];
168                                         /* total num ranges eliminated by
169                                            trans coalesce/flush */
170     rvm_length_t    tot_trans_elims[trans_elims_len];
171                                         /* space saved by range coalesce/flush */
172     rvm_length_t    tot_range_overlaps[range_overlaps_len];
173                                         /* space saved by trans coalesce/flush */
174     rvm_length_t    tot_trans_overlaps[range_overlaps_len];
175                                         /* transactions coalesced per flush  */
176     rvm_length_t    tot_trans_coalesces[trans_coalesces_len];
177     }
178 rvm_statistics_t;
179 /* get RVM statistics */
180 rvm_return_t rvm_statistics(const char *version, rvm_statistics_t *statistics);
181 #define RVM_STATISTICS(statistics) \
182     rvm_statistics(RVM_STATISTICS_VERSION,(statistics))
183 
184 /* rvm_statistics_t initializer, copier & finalizer */
185 
186 extern rvm_statistics_t *rvm_malloc_statistics ();
187 
188 extern void rvm_init_statistics(rvm_statistics_t *statistics);
189 extern rvm_statistics_t *rvm_copy_statistics(rvm_statistics_t *statistics);
190 extern void rvm_free_statistics(rvm_statistics_t *statistics);
191 
192 /* rvm_statistics_t printer */
193 extern rvm_return_t rvm_print_statistics(
194     rvm_statistics_t    *statistics,    /* pointer to record to be printed */
195     FILE                *out_stream     /* output stream */
196     );
197 
198 
199 #endif /* _RVM_STATISTICS_VERSION */
200