Lines Matching defs:value
68 struct hdr_histogram* h, int32_t index, int64_t value)
71 h->counts[normalised_index] += value;
72 h->total_count += value;
76 struct hdr_histogram* h, int32_t index, int64_t value)
80 hdr_atomic_add_fetch_64(&h->counts[normalised_index], value);
81 hdr_atomic_add_fetch_64(&h->total_count, value);
84 static void update_min_max(struct hdr_histogram* h, int64_t value)
86 h->min_value = (value < h->min_value && value != 0) ? value : h->min_value;
87 h->max_value = (value > h->max_value) ? value : h->max_value;
90 static void update_min_max_atomic(struct hdr_histogram* h, int64_t value)
98 if (0 == value || current_min_value <= value)
103 while (!hdr_atomic_compare_exchange_64(&h->min_value, ¤t_min_value, value));
109 if (value <= current_max_value)
114 while (!hdr_atomic_compare_exchange_64(&h->max_value, ¤t_max_value, value));
144 static int32_t count_leading_zeros_64(int64_t value)
149 _BitScanReverse64(&leading_zero, value);
151 uint32_t high = value >> 32;
158 uint32_t low = value & 0x00000000FFFFFFFF;
162 return 63 - leading_zero; /* smallest power of 2 containing value */
164 return __builtin_clzll(value); /* smallest power of 2 containing value */
168 static int32_t get_bucket_index(const struct hdr_histogram* h, int64_t value)
170 int32_t pow2ceiling = 64 - count_leading_zeros_64(value | h->sub_bucket_mask); /* smallest power of 2 containing value */
174 static int32_t get_sub_bucket_index(int64_t value, int32_t bucket_index, int32_t unit_magnitude)
176 return (int32_t)(value >> (bucket_index + unit_magnitude));
195 int32_t counts_index_for(const struct hdr_histogram* h, int64_t value)
197 int32_t bucket_index = get_bucket_index(h, value);
198 int32_t sub_bucket_index = get_sub_bucket_index(value, bucket_index, h->unit_magnitude);
217 int64_t hdr_size_of_equivalent_value_range(const struct hdr_histogram* h, int64_t value)
219 int32_t bucket_index = get_bucket_index(h, value);
220 int32_t sub_bucket_index = get_sub_bucket_index(value, bucket_index, h->unit_magnitude);
234 static int64_t lowest_equivalent_value(const struct hdr_histogram* h, int64_t value)
236 int32_t bucket_index = get_bucket_index(h, value);
237 int32_t sub_bucket_index = get_sub_bucket_index(value, bucket_index, h->unit_magnitude);
249 int64_t hdr_next_non_equivalent_value(const struct hdr_histogram *h, int64_t value)
251 return lowest_equivalent_value(h, value) + hdr_size_of_equivalent_value_range(h, value);
254 static int64_t highest_equivalent_value(const struct hdr_histogram* h, int64_t value)
256 return hdr_next_non_equivalent_value(h, value) - 1;
259 int64_t hdr_median_equivalent_value(const struct hdr_histogram *h, int64_t value)
261 return lowest_equivalent_value(h, value) + (hdr_size_of_equivalent_value_range(h, value) >> 1);
318 static int32_t buckets_needed_to_cover_value(int64_t value, int32_t sub_bucket_count, int32_t unit_magnitude)
322 while (smallest_untrackable_value <= value)
481 bool hdr_record_value(struct hdr_histogram* h, int64_t value)
483 return hdr_record_values(h, value, 1);
486 bool hdr_record_value_atomic(struct hdr_histogram* h, int64_t value)
488 return hdr_record_values_atomic(h, value, 1);
491 bool hdr_record_values(struct hdr_histogram* h, int64_t value, int64_t count)
495 if (value < 0)
500 counts_index = counts_index_for(h, value);
508 update_min_max(h, value);
513 bool hdr_record_values_atomic(struct hdr_histogram* h, int64_t value, int64_t count)
517 if (value < 0)
522 counts_index = counts_index_for(h, value);
530 update_min_max_atomic(h, value);
535 bool hdr_record_corrected_value(struct hdr_histogram* h, int64_t value, int64_t expected_interval)
537 return hdr_record_corrected_values(h, value, 1, expected_interval);
540 bool hdr_record_corrected_value_atomic(struct hdr_histogram* h, int64_t value, int64_t expected_interval)
542 return hdr_record_corrected_values_atomic(h, value, 1, expected_interval);
545 bool hdr_record_corrected_values(struct hdr_histogram* h, int64_t value, int64_t count, int64_t expected_interval)
549 if (!hdr_record_values(h, value, count))
554 if (expected_interval <= 0 || value <= expected_interval)
559 missing_value = value - expected_interval;
571 bool hdr_record_corrected_values_atomic(struct hdr_histogram* h, int64_t value, int64_t count, int64_t expected_interval)
575 if (!hdr_record_values_atomic(h, value, count))
580 if (expected_interval <= 0 || value <= expected_interval)
585 missing_value = value - expected_interval;
605 int64_t value = iter.value;
608 if (!hdr_record_values(h, value, count))
626 int64_t value = iter.value;
629 if (!hdr_record_corrected_values(h, value, count, expected_interval))
727 values[at_pos] = highest_equivalent_value(h, iter.value);
747 total += iter.count * hdr_median_equivalent_value(h, iter.value);
766 double dev = (hdr_median_equivalent_value(h, iter.value) * 1.0) - mean;
779 int64_t hdr_lowest_equivalent_value(const struct hdr_histogram* h, int64_t value)
781 return lowest_equivalent_value(h, value);
784 int64_t hdr_count_at_value(const struct hdr_histogram* h, int64_t value)
786 return counts_get_normalised(h, counts_index_for(h, value));
825 const int64_t value = hdr_value_at_index(iter->h, iter->counts_index);
826 const int32_t bucket_index = get_bucket_index(iter->h, value);
827 const int32_t sub_bucket_index = get_sub_bucket_index(value, bucket_index, iter->h->unit_magnitude);
832 iter->value = value;
879 update_iterated_values(iter, iter->value);
893 iter->value = 0;
944 update_iterated_values(iter, highest_equivalent_value(iter->h, iter->value));
1016 update_iterated_values(iter, iter->value);
1056 if (iter->value >= linear->next_value_reporting_level_lowest_equivalent)
1113 if (iter->value >= logarithmic->next_value_reporting_level_lowest_equivalent)
1196 double value = iter.highest_equivalent_value / value_scale;
1202 stream, line_format, value, percentile, total_count, inverted_percentile) < 0)