QuickIO  0.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Typedefs | Functions
bench.h File Reference

Mainly used for testing, these functions allow you to benchmark everything and anything and output it in a format readble by Jenkins. More...

#include "qev.h"

Go to the source code of this file.

Typedefs

typedef struct qev_bench qev_bench_t
 Miiiinnnneeee.
 
typedef gboolean(* qev_bench_cb )(void *data)
 The callback for all benchmark functions.
 

Functions

qev_bench_tqev_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...
 

Detailed Description

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

Function Documentation

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.

Note
All recorded bench results are in microseconds
Parameters
benchThe benchmark to use
nameThe name to give to this benchmark
fnThe function to call repeatedly
dataData to pass to fn
nThe 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
benchThe benchmark to use
nameThe name to give to this benchmark
fnThe function to call repeatedly
dataData to pass to fn
msHow long to run the benchmark for
qev_bench_t* qev_bench_new ( const gchar *  name,
const gchar *  file 
)

Create a new benchmark suite.

Parameters
nameThe name of the suite
fileThe 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
benchThe benchmark to use
nameThe name to give to this benchmark
nThe number of threads to race. n threads are spawned for both one and two.
oneThe first thread (spawned n times)
one_dataData to pass to the first thread
twoThe second thread (spawned n times)
two_dataData 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
benchThe benchmark to use
nameThe name of the benchmark
statThe stat being recorded
successIf the result is the result of a successful benchmark
valThe value of the stat