-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbelady.cpp
35 lines (30 loc) · 829 Bytes
/
belady.cpp
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
/*****************************************
Belady Preprocessing
*****************************************/
/*
string folder = "../output_trace/test/";
string file_path = folder + "addrtrace_bodytrack.out" ; //to_string(argv[1]);
FILE *fp_in;
fp_in = fopen(file_path.c_str(), "r");
assert(fp_in != NULL);
unsigned int tid;
ull block_addr;
ull count=0;
map<ull, CE_Belady*>::iterator ir;
while(!feof(fp_in)){
fscanf(fp_in, "%d %llu", &tid, &block_addr);
ir = block_data.find(block_addr);
if(ir ==block_data.end()){
block_data.insert(mp(block_addr, new CE_Belady(block_addr, tid, count)));
}
else{
if(ir->second->cur_owner != tid){
ir->second->add_sharer(tid);
}
ir->second->access_list.pb(mp(count, tid));
}
count++;
}
fclose(fp_in);
printf("Done reading file!\n");
*/