-
Notifications
You must be signed in to change notification settings - Fork 0
/
tracebp.h
88 lines (61 loc) · 1.65 KB
/
tracebp.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* An API for getting the next instuction in a program's
* executed instruction stream
* EECE 476 2012
*/
#define MAX_STR 255
#define GZ_CHUNK_SIZE (8 * 1024)
// An instruction from the trace file
typedef struct instruction_
{
char op[MAX_STR]; // String based op code (i.e. add, mul, beq, ...)
void *pc;
void *addr;
} instruction;
/*
* Initialize the instruction stream.
* Pass the tracefilename.
*/
void initInstructionStream(char* traceFilename);
/*
* Pass in a pointer to the instruction struct
* that will be populated.
* Returns 1 if there is another instruction
* Returns 0 if this is the last instruction
*/
int getNextInstruction( instruction* next_inst );
/*
* Determine whether the instruction is a load
* Returns 1 if it is a load
* Returns 0 if it is NOT a load
*/
int isLoad( char* op );
/*
* Determine whether the instruction is a store
* Returns 1 if it is a store
* Returns 0 if it is NOT a store
*/
int isStore( char* op );
/*
* Determine whether the instruction is a branch
* Returns 1 if it is a branch
* Returns 0 if it is NOT a branch
*/
int isBranch( char* op );
/*
* Close the last opened instruction stream
*/
void closeInstructionStream();
/*
* Print the memory access statistics.
*/
void printAccesses( int num_memory_accesses, int num_instrs, int num_data_load_accesses, int num_data_store_accesses );
/*
* Print the cache access statistics.
* NB: type = "i" or "d"
*/
void printCacheRates( char *type, int num_instrs, int num_misses, int num_accesses );
/*
* Print the branch and predictor outcomes.
*/
void printBP( int num_taken, int num_not_taken, int num_mispredictions );