-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark.h
56 lines (44 loc) · 1.11 KB
/
benchmark.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef __REALITY_BENCHMARK_H
#define __REALITY_BENCHMARK_H
#include <sys/time.h>
#include "contents.h"
#include "external/cJSON.h"
struct b_run {
struct timeval interval;
int success;
size_t inputBytes;
size_t outputBytes;
struct b_run *next;
};
typedef struct b_run RUN;
struct b_loop {
RUN* runs;
int correct;
struct b_loop *next;
};
typedef struct b_loop LOOP;
struct b_result {
LOOP* loops;
struct b_result* next;
};
typedef struct b_result RESULT;
void resultDestory(RESULT* r);
void printResult(const RESULT *r, int verbose, int formated);
struct b_test {
struct timeval timeout;
unsigned int threads;
CONTENTS* (**run)(const CONTENTS*);
unsigned int runCount;
const CONTENTS* input;
const CONTENTS* verifyData;
};
typedef struct b_test TEST;
TEST *testNew();
void testDestory(TEST *t);
void testSetTimeout(TEST *t, struct timeval* timeout);
void testSetThreads(TEST *t, unsigned int threads);
void testAddRun(TEST *t, CONTENTS* (*run)(const CONTENTS*));
void testSetTesting(TEST *t, const CONTENTS* data);
void testSetInput(TEST *t, const CONTENTS* input);
RESULT *testRun(TEST *t);
#endif