-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdare_base.cpp
More file actions
63 lines (49 loc) · 1.42 KB
/
dare_base.cpp
File metadata and controls
63 lines (49 loc) · 1.42 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
#include "dare_base.h"
extern bool append;
using namespace std;
/* This function also clears the data structure so that it can be called
multiple times if there's tons of data
*/
void dare_base::dump_data()
{
FILE *file;
/* Change the output file name to be a configurable option */
if(append)
{
file = fopen(output_file_name.c_str(), "a");
}
else
{
file = fopen(output_file_name.c_str(), "w");
append = false;
}
fprintf(file, "kernel t_start t_end t_elapsed thread_id\n");
/* transfer contents of kernel_vec to the file */
for(int i = 0; i < num_threads; ++i)
{
vector<class kernel_node> *v = kernel_vec[i];
for(int j = 0; j < v->size(); ++j)
{
class kernel_node &k = (*v)[j];
fprintf(
file,
"%s %lf %lf %lf %llu\n",
kernel_table[k.kernel_type].c_str(),
k.t_start,
k.t_end,
k.t_end - k.t_start,
k.thread_id
);
}
v->clear();
}
return;
}
/*Global Variables*/
/*
If there are multiple plasma_init()/plasma_finalize() sections, this indicates
whether a new output file must be created or if an existing file should be
appended to. plasma_finalize() should set the value to "false" if it is currently
"true"
*/
bool append = false;