Mainly used for testing, these functions allow you to benchmark everything and anything and output it in a format readble by Jenkins.
More...
Go to the source code of this file.
|
|
typedef struct qev_bench | qev_bench_t |
| | Miiiinnnneeee.
|
| |
|
typedef gboolean(* | qev_bench_cb )(void *data) |
| | The callback for all benchmark functions.
|
| |
|
| qev_bench_t * | qev_bench_new (const gchar *name, const gchar *file) |
| | Create a new benchmark suite. More...
|
| |
|
void | qev_bench_free (qev_bench_t *bench) |
| | Clean up after a benchmark, flush all the results to file, and move on.
|
| |
| void | qev_bench_fn (qev_bench_t *bench, const gchar *name, const qev_bench_cb fn, void *data, const guint n) |
| | Benchmark the runtime of a function n number of times. More...
|
| |
| void | qev_bench_fn_for (qev_bench_t *bench, const gchar *name, const qev_bench_cb fn, void *data, const guint ms) |
| | Benchmark how many times a function can run in ms milliseconds. More...
|
| |
| void | qev_bench_race (qev_bench_t *bench, const gchar *name, const guint n, GThreadFunc one, void *one_data, GThreadFunc two, void *two_data) |
| | Race n threads against n threads. More...
|
| |
| void | qev_bench_record (qev_bench_t *bench, const gchar *name, const gchar *stat, const gboolean success, const gint64 val) |
| | Record a benchmark result. More...
|
| |
Mainly used for testing, these functions allow you to benchmark everything and anything and output it in a format readble by Jenkins.
Unlike almost every other part of QEV, qev_bench_* functions are not safe to use from multiple threads with the same qev_bench_t.
- Author
- Andrew Stone andre.nosp@m.w@cl.nosp@m.ovar..nosp@m.com
- Copyright
- 2012-2014 Clear Channel Inc.
Benchmark the runtime of a function n number of times.
- Note
- All recorded bench results are in microseconds
- Parameters
-
| bench | The benchmark to use |
| name | The name to give to this benchmark |
| fn | The function to call repeatedly |
| data | Data to pass to fn |
| n | The number of times to call the function |
| void qev_bench_fn_for |
( |
qev_bench_t * |
bench, |
|
|
const gchar * |
name, |
|
|
const qev_bench_cb |
fn, |
|
|
void * |
data, |
|
|
const guint |
ms |
|
) |
| |
Benchmark how many times a function can run in ms milliseconds.
- Note
- All recorded bench results are in microseconds
- Parameters
-
| bench | The benchmark to use |
| name | The name to give to this benchmark |
| fn | The function to call repeatedly |
| data | Data to pass to fn |
| ms | How long to run the benchmark for |
| qev_bench_t* qev_bench_new |
( |
const gchar * |
name, |
|
|
const gchar * |
file |
|
) |
| |
Create a new benchmark suite.
- Parameters
-
| name | The name of the suite |
| file | The file to write xml results to |
- Returns
- The test suite, NULL on error.
| void qev_bench_race |
( |
qev_bench_t * |
bench, |
|
|
const gchar * |
name, |
|
|
const guint |
n, |
|
|
GThreadFunc |
one, |
|
|
void * |
one_data, |
|
|
GThreadFunc |
two, |
|
|
void * |
two_data |
|
) |
| |
Race n threads against n threads.
- Note
- All recorded bench results are in microseconds
- Parameters
-
| bench | The benchmark to use |
| name | The name to give to this benchmark |
| n | The number of threads to race. n threads are spawned for both one and two. |
| one | The first thread (spawned n times) |
| one_data | Data to pass to the first thread |
| two | The second thread (spawned n times) |
| two_data | Data to pass to the second thread |
| void qev_bench_record |
( |
qev_bench_t * |
bench, |
|
|
const gchar * |
name, |
|
|
const gchar * |
stat, |
|
|
const gboolean |
success, |
|
|
const gint64 |
val |
|
) |
| |
Record a benchmark result.
- Parameters
-
| bench | The benchmark to use |
| name | The name of the benchmark |
| stat | The stat being recorded |
| success | If the result is the result of a successful benchmark |
| val | The value of the stat |