-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.h
39 lines (29 loc) · 975 Bytes
/
constants.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
/**
* Name: constants.h
* Desc: Contain all types and constants for benchmark tests
*/
#pragma once
// long and int size on thinkpad verified with `getconf`
typedef unsigned long uint64_t;
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
// the fun_ptr does not take an input
typedef void (*fun_ptr)();
typedef uint64_t (*mod_ptr)(uint64_t);
typedef uint64_t (*ben_ptr)(fun_ptr);
typedef uint64_t (*m_ben_ptr)(void**, int, int);
// tested on 1000 trials of 100000 iterations
const uint32_t MEASUREMENT_OVERHEAD = 40;
#if !defined(ICACHE_HITS)
// empirically tested number of consecutive function calls for a function
// pointer to be in I_CACHE
const uint32_t ICACHE_HITS = 10;
#endif
// 10000 iterations empirically adds the test's instruction address in the I-Cache
#if !defined(ITERATIONS)
#define ITERATIONS 1 //for testing change to 10
#endif
#if !defined(TRIALS)
#define TRIALS 1000
#endif