timehist.h File Reference

This file contains functions to make a histogram of time values. More...


Data Structures

struct  th_buck
 Bucket of time history information. More...
struct  timehist
 Keep histogram of time values. More...

Defines

#define NUM_BUCKETS_HIST   40
 Number of buckets in a histogram.

Functions

struct timehisttimehist_setup ()
 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.
double timehist_quartile (struct timehist *hist, double q)
 Find time value for given quartile, such as 0.25, 0.50, 0.75.
void timehist_print (struct timehist *hist)
 Printout histogram.
void timehist_log (struct timehist *hist, const char *name)
 Log histogram, print it to the logfile.
void timehist_export (struct timehist *hist, size_t *array, size_t sz)
 Export histogram to an array.
void timehist_import (struct timehist *hist, size_t *array, size_t sz)
 Import histogram from an array.


Detailed Description

This file contains functions to make a histogram of time values.


Function Documentation

struct timehist* timehist_setup (  )  [read]

Setup a histogram, default.

Returns:
histogram or NULL on malloc failure.

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.

Parameters:
hist,: to delete

References timehist::buckets.

Referenced by mesh_delete(), and print_hist().

void timehist_clear ( struct timehist hist  ) 

Clear histogram.

Parameters:
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.

Parameters:
hist,: histogram
tv,: time value

References timehist::buckets, th_buck::count, timehist::num, timeval_smaller(), and th_buck::upper.

Referenced by mesh_send_reply().

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.

Parameters:
hist,: histogram. Interpolated information is used from it.
q,: quartile, 0.50 results in the median. Must be >0 and <1.
Returns:
: the time in seconds for that percentage.

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_print ( struct timehist hist  ) 

Printout histogram.

Parameters:
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.

Parameters:
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().

void timehist_export ( struct timehist hist,
size_t *  array,
size_t  sz 
)

Export histogram to an array.

Parameters:
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,
size_t *  array,
size_t  sz 
)

Import histogram from an array.

Parameters:
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().


Generated on Tue Oct 13 06:45:51 2009 for unbound by  doxygen 1.5.9