Benchmark Operations
Compounds
struct benchTypedefs
typedef bench bench_tFunctions
void bench_init (bench_t *b)void bench_start (bench_t *b)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 (seeget_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_tdata type. It must be initialized usingbench_init. For example:
bench_t b; bench_init (&b);Then, the piece of code that must be benchmarked is enclosed by calls to
bench_startandbench_stopas follows:
bench_start (&b); ... bench_stop (&b); bench_report (&b, "Operation");The
bench_reportfunction 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_startandbench_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_startandbench_stopcalls. It then reports the result.
- Parameters:
b pointer to benchmark record objectmsg 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 117 of file benchs.h.
References bench::b_start.
__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 133 of file benchs.h.
References bench::b_stop.
Copyright (C) 1999, 2000, 2001, 2002, 2003 Stéphane Carrez, France
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.