-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathci_lib.h
More file actions
72 lines (52 loc) · 1.9 KB
/
ci_lib.h
File metadata and controls
72 lines (52 loc) · 1.9 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <stdint.h>
#include <sys/types.h>
#include <unistd.h>
/* interrupt handler prototype */
typedef void (*ci_handler)(long);
/* prototype of function that can be called before CI is disabled or
* after CI is enabled in the interrupt handler */
typedef void (*ci_margin_hook)(void);
#ifdef __cplusplus
extern "C" {
#endif
/* for internal use by CI Pass */
extern __thread int LocalLC;
extern __thread int lc_disabled_count;
extern __thread int64_t NextInterval;
/******************************************
* CI configuration API *
* All configurations are thread-specific *
******************************************/
/* register interrupt handler */
void register_ci(int, int, ci_handler);
/* de-register interrupt handler */
void deregister_ci(void);
/* register a function to be called just before
* CI is disabled in the interrupt handler */
void register_ci_disable_hook(ci_margin_hook ci_func);
/* register a function to be called just after
* CI is enabled in the interrupt handler */
void register_ci_enable_hook(ci_margin_hook ci_func);
/* disable interrupt calls */
void ci_disable(void);
/* enable interrupt calls */
void ci_enable(void);
/* disable probe instrumentation, code should be non-preemptible */
void instr_disable(void);
/* enable probe instrumentation */
void instr_enable(void);
/* for internal use by CI API and CI Pass */
/* CI pass interrupt handler */
extern __thread ci_handler intvActionHook;
/* CI pass IR interrupt interval */
extern __thread uint64_t ci_ir_interval;
/* CI (cycles) pass IR reset interval when the target cycles is not exceeded */
extern __thread uint64_t ci_reset_ir_interval;
/* CI (cycles) pass cycles interrupt interval */
extern __thread uint64_t ci_cycles_interval;
/* CI (cycles) pass cycles interrupt threshold to fire the interrupt or
* reset the IR counter */
extern __thread uint64_t ci_cycles_threshold;
#ifdef __cplusplus
}
#endif