Barrelfish
Functions
bench.h File Reference

Bench library. More...

Functions

__BEGIN_DECLS void bench_init (void)
 Initialize benchmarking library. More...
 
cycles_t bench_avg (cycles_t *array, size_t len)
 Compute averages. More...
 
cycles_t bench_variance (cycles_t *array, size_t len)
 Compute variance. More...
 
void bench_stddev (cycles_t *array, size_t len, uint8_t correction, cycles_t *ret_avg, cycles_t *ret_stddev)
 computes the standard deviation s^2 of the sample data More...
 
cycles_t bench_min (cycles_t *array, size_t len)
 Compute minimum. More...
 
cycles_t bench_max (cycles_t *array, size_t len)
 Compute maximum. More...
 
cycles_t bench_tscoverhead (void)
 
cycles_t bench_time_diff (cycles_t tsc_start, cycles_t tsc_end)
 computes the differences of two time stamps with respecting overflow More...
 
bench_ctl_t * bench_ctl_init (enum bench_ctl_mode mode, size_t dimensions, size_t min_runs)
 
void bench_ctl_destroy (bench_ctl_t *ctl)
 
void bench_ctl_dry_runs (bench_ctl_t *ctl, size_t dry_runs)
 
bool bench_ctl_add_run (bench_ctl_t *ctl, cycles_t *result)
 
void bench_ctl_dump_csv (bench_ctl_t *ctl, const char *prefix, uint64_t tscperus)
 
void bench_ctl_dump_csv_bincounting (bench_ctl_t *ctl, size_t dimension, size_t bin_count, cycles_t min, cycles_t max, const char *prefix, cycles_t tscperus)
 

Detailed Description

Bench library.

Function Documentation

cycles_t bench_avg ( cycles_t array,
size_t  len 
)

Compute averages.

If certain datapoints should be ignored, they should be marked with #BENCH_IGNORE_WATERMARK

bool bench_ctl_add_run ( bench_ctl_t *  ctl,
cycles_t result 
)

Add results from one run of the benchmark.

Parameters
ctlControl handle
resultPointer to the 'dimensions' values of this run
Returns
true if this was the last run necessary, false if more runs are needed.
void bench_ctl_destroy ( bench_ctl_t *  ctl)

Frees all resources associated with this benchmark control instance. Should be called after the benchmark is done and the results are dumped.

Parameters
ctlControl handle
void bench_ctl_dry_runs ( bench_ctl_t *  ctl,
size_t  dry_runs 
)

Add a fixed number of dry runs whose results should not be recorded. Should be called before any calls to bench_ctl_add_run().

Parameters
ctlControl handle
dry_runsNumber of dry runs
void bench_ctl_dump_csv ( bench_ctl_t *  ctl,
const char *  prefix,
uint64_t  tscperus 
)

Dump results of the benchmark to the standard output. One line per run, the lines will be prefixed with prefix, the values separeted using commas.

Parameters
ctlControl handle
prefixString to be printed before each line
void bench_ctl_dump_csv_bincounting ( bench_ctl_t *  ctl,
size_t  dimension,
size_t  bin_count,
cycles_t  min,
cycles_t  max,
const char *  prefix,
cycles_t  tscperus 
)

Use bincounting to reduce the amount of data that is printed. One line per bin (bin_count + 2 for those below and above the specified range) with two columns each is emited at most. Lines for empty bins are omitted except for above and below. The first column contains the start of the range for this bin (or below/above for the border cases), while the second column contains the number of values in that bin.

Parameters
ctlControl handle
dimenisonIndex of the value in the run
bin_countNumber of bins to create
minMinimum of range to be represented by bins
maxMaximum of range to be represented by bins
prefixString to be printed before each line
tscperuscpu ticks per micro-second
bench_ctl_t* bench_ctl_init ( enum bench_ctl_mode  mode,
size_t  dimensions,
size_t  min_runs 
)

Initialize a benchmark control instance.

Parameters
modeMode of the benchmark (enum bench_ctl_mode)
dimensionsNumber of values each run produces
min_runsMinimal number of runs to be executed
Returns
Control handle, to be passed on subsequent calls to bench_ctl_ functions.
__BEGIN_DECLS void bench_init ( void  )

Initialize benchmarking library.

cycles_t bench_max ( cycles_t array,
size_t  len 
)

Compute maximum.

If certain datapoints should be ignored, they should be marked with #BENCH_IGNORE_WATERMARK

cycles_t bench_min ( cycles_t array,
size_t  len 
)

Compute minimum.

If certain datapoints should be ignored, they should be marked with #BENCH_IGNORE_WATERMARK

void bench_stddev ( cycles_t array,
size_t  len,
uint8_t  correction,
cycles_t ret_avg,
cycles_t ret_stddev 
)

computes the standard deviation s^2 of the sample data

Parameters
arrayarray of data to analyze
lensize of the array
correctionapply Bessel's correction (using N-1 instead of N)
ret_avgreturns the average of the sample
ret_stddevreturns the standard deviation squared of the sample

discard some initiali observations

cycles_t bench_time_diff ( cycles_t  tsc_start,
cycles_t  tsc_end 
)

computes the differences of two time stamps with respecting overflow

This function also accounts for the overhead when taking timestamps

Parameters
tsc_starttimestamp of start
tsc_endtimestamp of end
Returns
elaped cycles
cycles_t bench_tscoverhead ( void  )

Return the measured tsc overhead

cycles_t bench_variance ( cycles_t array,
size_t  len 
)

Compute variance.

If certain datapoints should be ignored, they should be marked with #BENCH_IGNORE_WATERMARK