lfn
serial
ticket/834-toolchain-update
topic/msim-upgrade
topic/simplify-dev-export
Last change
on this file since 94ebebf was 94ebebf, checked in by Vojtech Horky <vojtech.horky@…>, 6 years ago |
hbench: turn comments into doc-blocks
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[fe656783] | 1 | /** @addtogroup hbench hbench
|
---|
[94ebebf] | 2 | * @brief User space benchmarks
|
---|
[d230358] | 3 | * @ingroup apps
|
---|
[a362c16] | 4 | *
|
---|
| 5 | * @details
|
---|
| 6 | *
|
---|
| 7 | * To add a new benchmark, you need to implement the actual benchmarking
|
---|
| 8 | * code and register it.
|
---|
| 9 | *
|
---|
| 10 | * Registration is done by adding
|
---|
| 11 | * <code>extern benchmark_t bench_YOUR_NAME</code> reference to benchlist.h
|
---|
| 12 | * and by adding it to the array in benchlist.c.
|
---|
| 13 | *
|
---|
| 14 | * The actual benchmark should reside in a separate file (see malloc/malloc1.c
|
---|
| 15 | * for example) and has to (at least) declare one function (the actual
|
---|
| 16 | * benchmark) and fill-in the benchmark_t structure.
|
---|
| 17 | *
|
---|
| 18 | * Fill-in the name of the benchmark, its description and a reference to the
|
---|
| 19 | * benchmark function to the benchmark_t.
|
---|
| 20 | *
|
---|
[ebb0835] | 21 | * The benchmarking function has to accept four arguments:
|
---|
| 22 | * @li benchmeter_t: call benchmeter_start and benchmeter_stop around the
|
---|
| 23 | * actual benchmarking code
|
---|
[a362c16] | 24 | * @li uint64_t: size of the workload - typically number of inner loops in
|
---|
| 25 | * your benchmark (used to self-calibrate benchmark size)
|
---|
| 26 | * @li char * and size_t giving you access to buffer for storing error message
|
---|
| 27 | * if the benchmark fails (return false from the function itself then)
|
---|
| 28 | *
|
---|
| 29 | * Typically, the structure of the function is following:
|
---|
| 30 | * @code{c}
|
---|
[ebb0835] | 31 | * static bool runner(benchmeter_t *meter, uint64_t size,
|
---|
[a362c16] | 32 | * char *error, size_t error_size)
|
---|
| 33 | * {
|
---|
[ebb0835] | 34 | * benchmeter_start(meter);
|
---|
[a362c16] | 35 | * for (uint64_t i = 0; i < size; i++) {
|
---|
| 36 | * // measured action
|
---|
| 37 | * }
|
---|
[ebb0835] | 38 | * benchmeter_stop(meter);
|
---|
[a362c16] | 39 | *
|
---|
| 40 | * return true;
|
---|
| 41 | * }
|
---|
| 42 | * @endcode
|
---|
[d230358] | 43 | */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.