librfn
An ad-hoc utility library
Data Structures | Functions
Benchmark

Benchmark mechanism for real-time processing modules. More...

Data Structures

struct  rf_benchmark_t
 
struct  rf_benchmark_results_t
 

Functions

void rf_benchmark_init (rf_benchmark_t *b, uint64_t runtime)
 
bool rf_benchmark_running (rf_benchmark_t *b)
 
void rf_benchmark_finalize (rf_benchmark_t *b, uint64_t nominal, rf_benchmark_results_t *r)
 
void rf_benchmark_results_show (rf_benchmark_results_t *r, const char *tag)
 

Detailed Description

Benchmark mechanism for real-time processing modules.

This module contains library routines designed to estimate the CPU load of real-time data processing.

Rather than measure the CPU load directly the routine is run as fast as possible and the nominal time (number of minutes of data processed) is compared to the elapsed time.

uint64_t nominal;
rf_benchmark_init(&m, 2000000);
do {
process_1ms_of_data();
nominal += 1000;
} while (rf_benchmark_running(&bm);
rf_benchmark_finalize(&bm, nominal, &results);
rf_benchmark_results_show(&results, "process_1ms_of_data:");

Function Documentation

void rf_benchmark_finalize ( rf_benchmark_t b,
uint64_t  nominal,
rf_benchmark_results_t r 
)

Generate the benchmark results by comparing the actual runtime to the nominal runtime.

Definition at line 40 of file benchmark.c.

void rf_benchmark_init ( rf_benchmark_t b,
uint64_t  runtime 
)

Initialize a benchmark structure.

  • runtime Minimum time (in microseconds) that the benchmark must run for.

Definition at line 23 of file benchmark.c.

void rf_benchmark_results_show ( rf_benchmark_results_t r,
const char *  tag 
)

Definition at line 52 of file benchmark.c.

bool rf_benchmark_running ( rf_benchmark_t b)

Test whether the benchmark has completed it's minimum runtime.

Definition at line 34 of file benchmark.c.