Benchmark Operations

Description | Download | Table of Contents | Modules | Compound List | File List | Functions


Overview
Compiler
Documentation
Examples
Misc
Help
IDE & Tools

Download
Install

Links
Projects







Compounds

struct  bench

Functions

void bench_init (bench_t *b)
__inline__ void bench_start (bench_t *b)
__inline__ void bench_stop (bench_t *b)
void bench_report (bench_t *b, const char *msg,...)
void bench_empty (bench_t *b)

Detailed Description

The benchmark functions are designed to benchmark some piece of code in a precise and deterministic manner. Interrupts are masked during the benchmark. The benchmark uses the free running counter that exists in 68HC11 and 68HC12 (see get_timer_counter ). The implementation assumes that the free running counter can overflow only once during a benchmark. This imposes a restrictions on the benchmarked operation: they must be fast enough to not exceed 65536 times the update of the free running counter. For example on a 68HC11 @ 8Mhz they should not exceed 32ms.

The benchmark data is recorded in the bench_t data type. It must be initialized using bench_init. For example:

       bench_t b;

       bench_init (&b);
   

Then, the piece of code that must be benchmarked is enclosed by calls to bench_start and bench_stop as follows:

       bench_start (&b);
       ...
       bench_stop (&b);
       bench_report (&b, "Operation");
   

The bench_report function must be called to compute the time and print the result.


Function Documentation

void bench_empty ( bench_t * b )
 

Benchmark overhead computation.

This function computes the overhead of the benchmark operations bench_start and bench_stop.

Parameters:
b   pointer to benchmark record object
See also:
bench_init

void bench_init ( bench_t * b )
 

Initialize the benchmark object.

This function must be called to initialize the benchmark object. It locks the interrupts and computes the benchmark correction that will be applied to the results. The benchmark correction is based on the benchmark operations overhead computed using bench_empty.

Parameters:
b   pointer to benchmark record object
See also:
bench_start, bench_stop, bench_empty

void bench_report ( bench_t * b,
const char * msg,
... )
 

Report benchmark results.

This function computes the time spent between the bench_start and bench_stop calls. It then reports the result.

Parameters:
b   pointer to benchmark record object
msg   format description string
See also:
bench_start, bench_stop

__inline__ void bench_start ( bench_t * b )
 

Start the benchmark.

This function starts the benchmark operation by recording the precise time at which the measure begins.

Parameters:
b   pointer to benchmark record object
See also:
bench_stop, bench_init

Definition at line 115 of file benchs.h.

__inline__ void bench_stop ( bench_t * b )
 

Stop the benchmark.

This function finishes the benchmark operation by recording the precise time at which the measure stops.

Parameters:
b   pointer to benchmark record object
See also:
bench_start, bench_init

Definition at line 129 of file benchs.h.

Description | Download | Table of Contents | Modules | Compound List | File List | Functions

    Last modified,
    Apr 16, 2001
[ Copying ]     [ Feedback to Stephane.Carrez@worldnet.fr ]