Lines Matching +full:low +full:- +full:g
2 * util/timehist.c - make histogram of time values.
56 if(v->tv_sec == 0 && v->tv_usec == 0) { in timestwo()
57 v->tv_usec = 1; in timestwo()
60 v->tv_sec *= 2; in timestwo()
61 v->tv_usec *= 2; in timestwo()
62 if(v->tv_usec == 1024*1024) { in timestwo()
64 v->tv_sec = 1; in timestwo()
65 v->tv_usec = 0; in timestwo()
77 for(i=0; i<hist->num; i++) { in dosetup()
78 hist->buckets[i].lower = last; in dosetup()
80 hist->buckets[i].upper = last; in dosetup()
81 hist->buckets[i].count = 0; in dosetup()
91 hist->num = NUM_BUCKETS_HIST; in timehist_setup()
92 hist->buckets = (struct th_buck*)calloc(hist->num, in timehist_setup()
94 if(!hist->buckets) { in timehist_setup()
107 free(hist->buckets); in timehist_delete()
114 for(i=0; i<hist->num; i++) in timehist_clear()
115 hist->buckets[i].count = 0; in timehist_clear()
121 for(i=0; i<hist->num; i++) { in timehist_insert()
122 if(timeval_smaller(tv, &hist->buckets[i].upper)) { in timehist_insert()
123 hist->buckets[i].count++; in timehist_insert()
128 hist->buckets[hist->num-1].count++; in timehist_insert()
135 for(i=0; i<hist->num; i++) { in timehist_print()
136 if(hist->buckets[i].count != 0) { in timehist_print()
138 (int)hist->buckets[i].lower.tv_sec, in timehist_print()
139 (int)hist->buckets[i].lower.tv_usec, in timehist_print()
140 (int)hist->buckets[i].upper.tv_sec, in timehist_print()
141 (int)hist->buckets[i].upper.tv_usec, in timehist_print()
142 (unsigned)hist->buckets[i].count); in timehist_print()
152 log_info("[25%%]=%g median[50%%]=%g [75%%]=%g", in timehist_log()
158 for(i=0; i<hist->num; i++) { in timehist_log()
159 if(hist->buckets[i].count != 0) { in timehist_log()
161 (int)hist->buckets[i].lower.tv_sec, in timehist_log()
162 (int)hist->buckets[i].lower.tv_usec, in timehist_log()
163 (int)hist->buckets[i].upper.tv_sec, in timehist_log()
164 (int)hist->buckets[i].upper.tv_usec, in timehist_log()
165 (unsigned)hist->buckets[i].count); in timehist_log()
176 for(i=0; i<hist->num; i++) in timehist_count()
177 res += hist->buckets[i].count; in timehist_count()
185 double low = 0, up = 0; in timehist_quartile() local
187 if(!hist || hist->num == 0) in timehist_quartile()
196 while(i+1 < hist->num && in timehist_quartile()
197 passed+(double)hist->buckets[i].count < lookfor) { in timehist_quartile()
198 passed += (double)hist->buckets[i++].count; in timehist_quartile()
202 low = (double)hist->buckets[i].lower.tv_sec + in timehist_quartile()
203 (double)hist->buckets[i].lower.tv_usec/1000000.; in timehist_quartile()
204 up = (double)hist->buckets[i].upper.tv_sec + in timehist_quartile()
205 (double)hist->buckets[i].upper.tv_usec/1000000.; in timehist_quartile()
207 res = (lookfor - passed)*(up-low)/((double)hist->buckets[i].count); in timehist_quartile()
208 return low+res; in timehist_quartile()
216 if(sz > hist->num) in timehist_export()
217 sz = hist->num; in timehist_export()
219 array[i] = (long long)hist->buckets[i].count; in timehist_export()
227 if(sz > hist->num) in timehist_import()
228 sz = hist->num; in timehist_import()
230 hist->buckets[i].count = (size_t)array[i]; in timehist_import()