Lines Matching full:bucket

33   struct hist_bucket bucket[RATE_BINS];  member
62 hist->bucket[i].low = INT_MAX; in init_rate_histogram()
63 hist->bucket[i].high = 0; in init_rate_histogram()
64 hist->bucket[i].count = 0; in init_rate_histogram()
118 if (hist->bucket[idx].low > avg_bitrate) in update_rate_histogram()
119 hist->bucket[idx].low = (int)avg_bitrate; in update_rate_histogram()
120 if (hist->bucket[idx].high < avg_bitrate) in update_rate_histogram()
121 hist->bucket[idx].high = (int)avg_bitrate; in update_rate_histogram()
122 hist->bucket[idx].count++; in update_rate_histogram()
126 static int merge_hist_buckets(struct hist_bucket *bucket, int max_buckets, in merge_hist_buckets() argument
132 assert(bucket != NULL); in merge_hist_buckets()
140 if (bucket[i].count < bucket[small_bucket].count) small_bucket = i; in merge_hist_buckets()
141 if (bucket[i].count > bucket[big_bucket].count) big_bucket = i; in merge_hist_buckets()
145 * bucket. in merge_hist_buckets()
150 /* merge the small bucket with an adjacent one. */ in merge_hist_buckets()
155 else if (bucket[small_bucket - 1].count < bucket[small_bucket + 1].count) in merge_hist_buckets()
166 bucket[merge_bucket].high = bucket[small_bucket].high; in merge_hist_buckets()
167 bucket[merge_bucket].count += bucket[small_bucket].count; in merge_hist_buckets()
169 bucket[small_bucket].high = bucket[merge_bucket].high; in merge_hist_buckets()
170 bucket[small_bucket].count += bucket[merge_bucket].count; in merge_hist_buckets()
174 assert(bucket[merge_bucket].low != bucket[merge_bucket].high); in merge_hist_buckets()
183 if (i > merge_bucket) bucket[i] = bucket[i + 1]; in merge_hist_buckets()
185 if (bucket[i].count < bucket[small_bucket].count) small_bucket = i; in merge_hist_buckets()
186 if (bucket[i].count > bucket[big_bucket].count) big_bucket = i; in merge_hist_buckets()
191 return bucket[big_bucket].count; in merge_hist_buckets()
194 static void show_histogram(const struct hist_bucket *bucket, int buckets, in show_histogram() argument
199 assert(bucket != NULL); in show_histogram()
201 switch ((int)(log(bucket[buckets - 1].high) / log(10)) + 1) { in show_histogram()
238 pct = (float)(100.0 * bucket[i].count / total); in show_histogram()
239 len = HIST_BAR_MAX * bucket[i].count / scale; in show_histogram()
243 if (bucket[i].low == bucket[i].high) in show_histogram()
244 fprintf(stderr, pat1, bucket[i].low, ""); in show_histogram()
246 fprintf(stderr, pat2, bucket[i].low, bucket[i].high); in show_histogram()
249 fprintf(stderr, "\t%5d (%6.2f%%)\n", bucket[i].count, pct); in show_histogram()
254 struct hist_bucket bucket[64]; in show_q_histogram() local
262 bucket[buckets].low = bucket[buckets].high = i; in show_q_histogram()
263 bucket[buckets].count = counts[i]; in show_q_histogram()
270 scale = merge_hist_buckets(bucket, max_buckets, &buckets); in show_q_histogram()
271 show_histogram(bucket, buckets, total, scale); in show_q_histogram()
282 if (hist->bucket[i].low == INT_MAX) continue; in show_rate_histogram()
283 hist->bucket[buckets++] = hist->bucket[i]; in show_rate_histogram()
287 scale = merge_hist_buckets(hist->bucket, max_buckets, &buckets); in show_rate_histogram()
288 show_histogram(hist->bucket, buckets, hist->total, scale); in show_rate_histogram()