This file contains functions to make a histogram of time values. More...
#include "config.h"#include <sys/time.h>#include <sys/types.h>#include "util/timehist.h"#include "util/log.h"#include "util/timeval_func.h"Functions | |
| static void | timestwo (struct timeval *v) |
| special timestwo operation for time values in histogram setup | |
| static void | dosetup (struct timehist *hist) |
| do setup exponentially | |
| struct timehist * | timehist_setup (void) |
| Setup a histogram, default. | |
| void | timehist_delete (struct timehist *hist) |
| Delete histogram. | |
| void | timehist_clear (struct timehist *hist) |
| Clear histogram. | |
| void | timehist_insert (struct timehist *hist, struct timeval *tv) |
| Add time value to histogram. | |
| void | timehist_print (struct timehist *hist) |
| Printout histogram. | |
| void | timehist_log (struct timehist *hist, const char *name) |
| Log histogram, print it to the logfile. | |
| static size_t | timehist_count (struct timehist *hist) |
| total number in histogram | |
| double | timehist_quartile (struct timehist *hist, double q) |
| Find time value for given quartile, such as 0.25, 0.50, 0.75. | |
| void | timehist_export (struct timehist *hist, long long *array, size_t sz) |
| Export histogram to an array. | |
| void | timehist_import (struct timehist *hist, long long *array, size_t sz) |
| Import histogram from an array. | |
This file contains functions to make a histogram of time values.
| struct timehist * timehist_setup | ( | void | ) |
Setup a histogram, default.
References timehist::buckets, dosetup(), timehist::num, and NUM_BUCKETS_HIST.
Referenced by mesh_create(), and print_hist().
| void timehist_delete | ( | struct timehist * | hist | ) |
Delete histogram.
| hist | to delete |
References timehist::buckets.
Referenced by mesh_delete(), and print_hist().
| void timehist_clear | ( | struct timehist * | hist | ) |
Clear histogram.
| hist | to clear all data from |
References timehist::buckets, th_buck::count, and timehist::num.
Referenced by mesh_stats_clear().
| void timehist_insert | ( | struct timehist * | hist, |
| struct timeval * | tv | ||
| ) |
Add time value to histogram.
| hist | histogram |
| tv | time value |
References timehist::buckets, th_buck::count, timehist::num, timeval_smaller(), and th_buck::upper.
Referenced by mesh_send_reply().
| void timehist_print | ( | struct timehist * | hist | ) |
Printout histogram.
| hist | histogram |
References timehist::buckets, th_buck::count, th_buck::lower, timehist::num, and th_buck::upper.
| void timehist_log | ( | struct timehist * | hist, |
| const char * | name | ||
| ) |
Log histogram, print it to the logfile.
| hist | histogram |
| name | the name of the value column |
References timehist::buckets, th_buck::count, log_info(), th_buck::lower, timehist::num, timehist_quartile(), and th_buck::upper.
Referenced by mesh_stats().
| double timehist_quartile | ( | struct timehist * | hist, |
| double | q | ||
| ) |
Find time value for given quartile, such as 0.25, 0.50, 0.75.
The looks up the value for the i-th element in the sorted list of time values, as approximated using the histogram.
| hist | histogram. Interpolated information is used from it. |
| q | quartile, 0.50 results in the median. Must be >0 and <1. |
References timehist::buckets, th_buck::count, th_buck::lower, timehist::num, timehist_count(), and th_buck::upper.
Referenced by server_stats_compile(), and timehist_log().
| void timehist_export | ( | struct timehist * | hist, |
| long long * | array, | ||
| size_t | sz | ||
| ) |
Export histogram to an array.
| hist | histogram |
| array | the array to export to. |
| sz | number of items in array. |
References timehist::buckets, th_buck::count, and timehist::num.
Referenced by server_stats_compile().
| void timehist_import | ( | struct timehist * | hist, |
| long long * | array, | ||
| size_t | sz | ||
| ) |
Import histogram from an array.
| hist | histogram |
| array | the array to import from. |
| sz | number of items in array. |
References timehist::buckets, th_buck::count, and timehist::num.
Referenced by print_hist().