Lines Matching full:bucket

34   struct hist_bucket bucket[RATE_BINS];  member
57 hist->bucket[i].low = INT_MAX; in init_rate_histogram()
58 hist->bucket[i].high = 0; in init_rate_histogram()
59 hist->bucket[i].count = 0; in init_rate_histogram()
109 if (hist->bucket[idx].low > avg_bitrate) in update_rate_histogram()
110 hist->bucket[idx].low = (int)avg_bitrate; in update_rate_histogram()
111 if (hist->bucket[idx].high < avg_bitrate) in update_rate_histogram()
112 hist->bucket[idx].high = (int)avg_bitrate; in update_rate_histogram()
113 hist->bucket[idx].count++; in update_rate_histogram()
117 static int merge_hist_buckets(struct hist_bucket *bucket, int max_buckets, in merge_hist_buckets() argument
126 if (bucket[i].count < bucket[small_bucket].count) small_bucket = i; in merge_hist_buckets()
127 if (bucket[i].count > bucket[big_bucket].count) big_bucket = i; in merge_hist_buckets()
131 * bucket. in merge_hist_buckets()
136 /* merge the small bucket with an adjacent one. */ in merge_hist_buckets()
141 else if (bucket[small_bucket - 1].count < bucket[small_bucket + 1].count) in merge_hist_buckets()
152 bucket[merge_bucket].high = bucket[small_bucket].high; in merge_hist_buckets()
153 bucket[merge_bucket].count += bucket[small_bucket].count; in merge_hist_buckets()
155 bucket[small_bucket].high = bucket[merge_bucket].high; in merge_hist_buckets()
156 bucket[small_bucket].count += bucket[merge_bucket].count; in merge_hist_buckets()
160 assert(bucket[merge_bucket].low != bucket[merge_bucket].high); in merge_hist_buckets()
169 if (i > merge_bucket) bucket[i] = bucket[i + 1]; in merge_hist_buckets()
171 if (bucket[i].count < bucket[small_bucket].count) small_bucket = i; in merge_hist_buckets()
172 if (bucket[i].count > bucket[big_bucket].count) big_bucket = i; in merge_hist_buckets()
177 return bucket[big_bucket].count; in merge_hist_buckets()
180 static void show_histogram(const struct hist_bucket *bucket, int buckets, in show_histogram() argument
185 switch ((int)(log(bucket[buckets - 1].high) / log(10)) + 1) { in show_histogram()
222 pct = (float)(100.0 * bucket[i].count / total); in show_histogram()
223 len = HIST_BAR_MAX * bucket[i].count / scale; in show_histogram()
227 if (bucket[i].low == bucket[i].high) in show_histogram()
228 fprintf(stderr, pat1, bucket[i].low, ""); in show_histogram()
230 fprintf(stderr, pat2, bucket[i].low, bucket[i].high); in show_histogram()
233 fprintf(stderr, "\t%5d (%6.2f%%)\n", bucket[i].count, pct); in show_histogram()
238 struct hist_bucket bucket[64]; in show_q_histogram() local
246 bucket[buckets].low = bucket[buckets].high = i; in show_q_histogram()
247 bucket[buckets].count = counts[i]; in show_q_histogram()
254 scale = merge_hist_buckets(bucket, max_buckets, &buckets); in show_q_histogram()
255 show_histogram(bucket, buckets, total, scale); in show_q_histogram()
264 if (hist->bucket[i].low == INT_MAX) continue; in show_rate_histogram()
265 hist->bucket[buckets++] = hist->bucket[i]; in show_rate_histogram()
269 scale = merge_hist_buckets(hist->bucket, max_buckets, &buckets); in show_rate_histogram()
270 show_histogram(hist->bucket, buckets, hist->total, scale); in show_rate_histogram()