1616
1717struct hdr_histogram
1818{
19- int64_t lowest_trackable_value ;
19+ int64_t lowest_discernible_value ;
2020 int64_t highest_trackable_value ;
2121 int32_t unit_magnitude ;
2222 int32_t significant_figures ;
@@ -45,21 +45,21 @@ extern "C" {
4545 * involved math on the input parameters this function it is tricky to stack allocate.
4646 * The histogram should be released with hdr_close
4747 *
48- * @param lowest_trackable_value The smallest possible value to be put into the
49- * histogram .
48+ * @param lowest_discernible_value The smallest possible value that is distinguishable from 0.
49+ * Must be a positive integer that is >= 1. May be internally rounded down to nearest power of 2 .
5050 * @param highest_trackable_value The largest possible value to be put into the
5151 * histogram.
5252 * @param significant_figures The level of precision for this histogram, i.e. the number
5353 * of figures in a decimal number that will be maintained. E.g. a value of 3 will mean
5454 * the results from the histogram will be accurate up to the first three digits. Must
5555 * be a value between 1 and 5 (inclusive).
5656 * @param result Output parameter to capture allocated histogram.
57- * @return 0 on success, EINVAL if lowest_trackable_value is < 1 or the
57+ * @return 0 on success, EINVAL if lowest_discernible_value is < 1 or the
5858 * significant_figure value is outside of the allowed range, ENOMEM if malloc
5959 * failed.
6060 */
6161int hdr_init (
62- int64_t lowest_trackable_value ,
62+ int64_t lowest_discernible_value ,
6363 int64_t highest_trackable_value ,
6464 int significant_figures ,
6565 struct hdr_histogram * * result );
@@ -159,27 +159,27 @@ bool hdr_record_values_atomic(struct hdr_histogram* h, int64_t value, int64_t co
159159 * Record a value in the histogram and backfill based on an expected interval.
160160 *
161161 * Records a value in the histogram, will round this value of to a precision at or better
162- * than the significant_figure specified at contruction time. This is specifically used
162+ * than the significant_figure specified at construction time. This is specifically used
163163 * for recording latency. If the value is larger than the expected_interval then the
164164 * latency recording system has experienced co-ordinated omission. This method fills in the
165- * values that would have occured had the client providing the load not been blocked.
165+ * values that would have occurred had the client providing the load not been blocked.
166166
167167 * @param h "This" pointer
168168 * @param value Value to add to the histogram
169169 * @param expected_interval The delay between recording values.
170170 * @return false if the value is larger than the highest_trackable_value and can't be recorded,
171171 * true otherwise.
172172 */
173- bool hdr_record_corrected_value (struct hdr_histogram * h , int64_t value , int64_t expexcted_interval );
173+ bool hdr_record_corrected_value (struct hdr_histogram * h , int64_t value , int64_t expected_interval );
174174
175175/**
176176 * Record a value in the histogram and backfill based on an expected interval.
177177 *
178178 * Records a value in the histogram, will round this value of to a precision at or better
179- * than the significant_figure specified at contruction time. This is specifically used
179+ * than the significant_figure specified at construction time. This is specifically used
180180 * for recording latency. If the value is larger than the expected_interval then the
181181 * latency recording system has experienced co-ordinated omission. This method fills in the
182- * values that would have occured had the client providing the load not been blocked.
182+ * values that would have occurred had the client providing the load not been blocked.
183183 *
184184 * Will record this value atomically, however the whole structure may appear inconsistent
185185 * when read concurrently with this update. Do NOT mix calls to this method with calls
@@ -191,7 +191,7 @@ bool hdr_record_corrected_value(struct hdr_histogram* h, int64_t value, int64_t
191191 * @return false if the value is larger than the highest_trackable_value and can't be recorded,
192192 * true otherwise.
193193 */
194- bool hdr_record_corrected_value_atomic (struct hdr_histogram * h , int64_t value , int64_t expexcted_interval );
194+ bool hdr_record_corrected_value_atomic (struct hdr_histogram * h , int64_t value , int64_t expected_interval );
195195
196196/**
197197 * Record a value in the histogram 'count' times. Applies the same correcting logic
@@ -226,7 +226,7 @@ bool hdr_record_corrected_values_atomic(struct hdr_histogram* h, int64_t value,
226226/**
227227 * Adds all of the values from 'from' to 'this' histogram. Will return the
228228 * number of values that are dropped when copying. Values will be dropped
229- * if they around outside of h.lowest_trackable_value and
229+ * if they around outside of h.lowest_discernible_value and
230230 * h.highest_trackable_value.
231231 *
232232 * @param h "This" pointer
@@ -238,7 +238,7 @@ int64_t hdr_add(struct hdr_histogram* h, const struct hdr_histogram* from);
238238/**
239239 * Adds all of the values from 'from' to 'this' histogram. Will return the
240240 * number of values that are dropped when copying. Values will be dropped
241- * if they around outside of h.lowest_trackable_value and
241+ * if they around outside of h.lowest_discernible_value and
242242 * h.highest_trackable_value.
243243 *
244244 * @param h "This" pointer
@@ -272,6 +272,18 @@ int64_t hdr_max(const struct hdr_histogram* h);
272272 */
273273int64_t hdr_value_at_percentile (const struct hdr_histogram * h , double percentile );
274274
275+ /**
276+ * Get the values at the given percentiles.
277+ *
278+ * @param h "This" pointer.
279+ * @param percentiles The ordered percentiles array to get the values for.
280+ * @param length Number of elements in the arrays.
281+ * @param values Destination array containing the values at the given percentiles.
282+ * The values array should be allocated by the caller.
283+ * @return 0 on success, ENOMEM if the provided destination array is null.
284+ */
285+ int hdr_value_at_percentiles (const struct hdr_histogram * h , const double * percentiles , int64_t * values , size_t length );
286+
275287/**
276288 * Gets the standard deviation for the values in the histogram.
277289 *
@@ -465,7 +477,7 @@ int hdr_percentiles_print(
465477*/
466478struct hdr_histogram_bucket_config
467479{
468- int64_t lowest_trackable_value ;
480+ int64_t lowest_discernible_value ;
469481 int64_t highest_trackable_value ;
470482 int64_t unit_magnitude ;
471483 int64_t significant_figures ;
@@ -478,7 +490,7 @@ struct hdr_histogram_bucket_config
478490};
479491
480492int hdr_calculate_bucket_config (
481- int64_t lowest_trackable_value ,
493+ int64_t lowest_discernible_value ,
482494 int64_t highest_trackable_value ,
483495 int significant_figures ,
484496 struct hdr_histogram_bucket_config * cfg );
@@ -492,7 +504,7 @@ int64_t hdr_next_non_equivalent_value(const struct hdr_histogram* h, int64_t val
492504int64_t hdr_median_equivalent_value (const struct hdr_histogram * h , int64_t value );
493505
494506/**
495- * Used to reset counters after importing data manuallying into the histogram, used by the logging code
507+ * Used to reset counters after importing data manually into the histogram, used by the logging code
496508 * and other custom serialisation tools.
497509 */
498510void hdr_reset_internal_counters (struct hdr_histogram * h );
0 commit comments