28 #ifdef BENCHMARK_SLOW_MACHINE
29 #define NUM_CYCLES 1000
31 #define NUM_CYCLES 1000000
85 static int atomic_run_fibre(
fibre_t *fibre)
128 .friend = &simple_run[1].
fibre,
133 .friend = &simple_run[0].
fibre,
141 .friend = &atomic_run[1].
fibre,
146 .friend = &atomic_run[0].
fibre,
153 memset(results, 0,
sizeof(*results));
165 next_action = results->
wakeup;
193 static const char *lookup_name(
int n)
195 static char lower[16];
196 #define C(x) case BENCHMARK_ ## x: strncpy(lower, #x, sizeof(lower)); break
207 lower[
sizeof(lower)-1] =
'\0';
216 const char *retval = lookup_name(n);
218 memcpy(s, &results->
stats[n],
sizeof(*s));
228 printf(
"Test Min Mean Max\n");
229 printf(
"----------------------------------------------\n");
232 printf(
"%-16s%11d%11d%11d\n", name,
241 fprintf(f,
"\"Test\",\"Min\",\"Mean\",\"Max\"\n");
243 fprintf(f,
"\"%s\",%d,%d,%d\n", name,
#define containerof(ptr, type, member)
void stats_add(stats_t *s, statval_t d)
void stats_init(stats_t *s)
Micro benchmark suite for some librfn features.
#define FIBRE_VAR_INIT(fn)
Static initializer for a fibre descriptor.
int yield_fibre(fibre_t *f)
int benchmark_run_once(benchmark_results_t *results)
stats_t stats[BENCHMARK_MAX]
const char * benchmark_get_result(benchmark_results_t *results, int n, stats_t *s)
void benchmark_show_results(benchmark_results_t *results)
bool fibre_run_atomic(fibre_t *f)
char * strtolower(char *s)
void benchmark_show_csv(benchmark_results_t *results, FILE *f)
void benchmark_init(benchmark_results_t *results, fibre_t *wakeup)
#define PT_BEGIN_FIBRE(f)
Fibre aware alternative to PT_BEGIN().
statval_t stats_mean(stats_t *s)
void fibre_run(fibre_t *f)