timehist.c File Reference

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

#include "config.h"
#include "util/timehist.h"
#include "util/log.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 timehisttimehist_setup ()
 Setup a histogram, default.
void timehist_delete (struct timehist *hist)
 Delete histogram.
void timehist_clear (struct timehist *hist)
 Clear histogram.
static int timeval_smaller (struct timeval *x, struct timeval *y)
 histogram compare of time values
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.
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.


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(), and timehist::num.

Referenced by mesh_create().

void timehist_delete ( struct timehist hist  ) 

Delete histogram.

Parameters:
hist,: to delete

References timehist::buckets.

Referenced by mesh_delete().

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

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

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 timehist_log().


Generated on Sun Sep 21 16:23:30 2008 for unbound by  doxygen 1.5.6