librfn
An ad-hoc utility library
benchmark.h
Go to the documentation of this file.
1 /*
2  * benchmark.h
3  *
4  * Part of librfn (a general utility library from redfelineninja.org.uk)
5  *
6  * Copyright (C) 2012-2014 Daniel Thompson <daniel@redfelineninja.org.uk>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published
10  * by the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  */
13 
14 #ifndef RF_BENCHMARK_H_
15 #define RF_BENCHMARK_H_
16 
17 #include <stdbool.h>
18 #include <stdint.h>
19 
48 typedef struct {
49  uint64_t start;
50  uint64_t expiry;
51  uint64_t end;
53 
54 typedef struct {
55  double ratio;
56  double cpu_usage;
58 
64 void rf_benchmark_init(rf_benchmark_t *b, uint64_t runtime);
65 
70 
75 
76 void rf_benchmark_results_show(rf_benchmark_results_t *r, const char *tag);
77 
79 #endif // RF_BENCHMARK_H_
bool rf_benchmark_running(rf_benchmark_t *b)
Definition: benchmark.c:34
uint64_t expiry
Definition: benchmark.h:50
struct bravo b
void rf_benchmark_finalize(rf_benchmark_t *b, uint64_t nominal, rf_benchmark_results_t *r)
Definition: benchmark.c:40
uint64_t start
Definition: benchmark.h:49
void rf_benchmark_results_show(rf_benchmark_results_t *r, const char *tag)
Definition: benchmark.c:52
uint64_t end
Definition: benchmark.h:51
void rf_benchmark_init(rf_benchmark_t *b, uint64_t runtime)
Definition: benchmark.c:23
double ratio
Degree by which we run faster than real time (x2 mean twice)
Definition: benchmark.h:55
double cpu_usage
Estimated CPU usage at x1.
Definition: benchmark.h:56