-
Notifications
You must be signed in to change notification settings - Fork 0
/
papijvm.cpp
36 lines (29 loc) · 1.02 KB
/
papijvm.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
#include "cloudpapi.hpp"
#include <vector>
#include <string>
#include <string.h>
const std::vector< std::string > classnameopt = { "--classname", "-c", "--performancecounter", "-pc" };
int main(int argc, char** argv) {
std::string classname;
std::vector<int> perfcounter;
if(argc == 1) {
perror("papijvm requires --classname and atleast 1 --performancecounter");
exit(1);
}
for(int i = 0; i < argc, i++) {
if(strncmp(argv[i], classnameopt[0].c_str(), classnameopt[0].size()) == 0) {
classname = argv[i+1];
}
else if(strncmp(argv[i], classnameopt[1].c_str(), classnameopt[1].size()) == 0) {
classname = argv[i+1];
}
else if(strncmp(argv[i], classnameopt[2].c_str(), classnameopt[2].size()) == 0) {
perfcounter.push_back(get_papi_event(atoi(argv[i+1])));
}
else if(strncmp(argv[i], classnameopt[3].c_str(), classnameopt[3].size()) == 0) {
perfcounter.push_back(get_papi_event(atoi(argv[i+1])));
}
}
papi_exec("jvm", classname.c_str(), perfcounter);
return 1;
}