aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2009-09-16 11:31:39 -0700
committerBen Cheng <bccheng@google.com>2009-09-16 11:31:39 -0700
commit1434507eb3c837aa83306fca335f49d5ad3dec4e (patch)
tree45a04710b46d81a83d0e5158d052683016c6a92e
parent5a4eb4eb367eccd4b976d1feae96cea96d2c50f2 (diff)
downloadoprofile-1434507eb3c837aa83306fca335f49d5ad3dec4e.tar.gz
More change to use all 5 performance counters on ARMv7.
-rw-r--r--opcontrol/opcontrol.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/opcontrol/opcontrol.cpp b/opcontrol/opcontrol.cpp
index 8b79c7e..2558760 100644
--- a/opcontrol/opcontrol.cpp
+++ b/opcontrol/opcontrol.cpp
@@ -42,10 +42,10 @@
#if !defined(WITH_ARM_V7_A)
#define MAX_EVENTS 3
-int min_count[3] = {150000, 200000, 250000};
+int min_count[MAX_EVENTS] = {150000, 200000, 250000};
#else
-#define MAX_EVENTS 4
-int min_count[4] = {150000, 200000, 250000, 300000};
+#define MAX_EVENTS 5
+int min_count[MAX_EVENTS] = {150000, 200000, 250000, 300000, 350000};
#endif
int list_events;
@@ -233,7 +233,8 @@ struct event_info {
#endif
};
-void usage() {
+void usage()
+{
printf("\nopcontrol: usage:\n"
" --list-events list event types\n"
" --help this message\n"
@@ -255,7 +256,8 @@ void usage() {
);
}
-void setup_session_dir() {
+void setup_session_dir()
+{
int fd;
fd = open(OP_DATA_DIR, O_RDONLY);
@@ -274,7 +276,8 @@ void setup_session_dir() {
}
}
-int do_setup() {
+int do_setup()
+{
char dir[1024];
setup_session_dir();
@@ -302,7 +305,8 @@ void do_list_events()
}
}
-int find_event_id_from_name(const char *name) {
+int find_event_idx_from_name(const char *name)
+{
unsigned int i;
for (i = 0; i < sizeof(event_info)/sizeof(struct event_info); i++) {
@@ -313,7 +317,8 @@ int find_event_id_from_name(const char *name) {
return -1;
}
-const char * find_event_name_from_id(int id) {
+const char * find_event_name_from_id(int id)
+{
unsigned int i;
for (i = 0; i < sizeof(event_info)/sizeof(struct event_info); i++) {
@@ -324,11 +329,12 @@ const char * find_event_name_from_id(int id) {
return NULL;
}
-int process_event(const char *event_spec) {
+int process_event(const char *event_spec)
+{
char event_name[512];
char count_name[512];
unsigned int i;
- int event_id;
+ int event_idx;
int count_val;
strncpy(event_name, event_spec, 512);
@@ -345,8 +351,8 @@ int process_event(const char *event_spec) {
break;
}
}
- event_id = find_event_id_from_name(event_name);
- if (event_id == -1) {
+ event_idx = find_event_idx_from_name(event_name);
+ if (event_idx == -1) {
fprintf(stderr, "Unknown event name: %s\n", event_name);
return -1;
}
@@ -358,9 +364,9 @@ int process_event(const char *event_spec) {
count_val = atoi(count_name);
}
- selected_events[num_events] = event_id;
+ selected_events[num_events] = event_idx;
selected_counts[num_events++] = count_val;
- verbose("event_id is %d\n", event_id);
+ verbose("event_id is %d\n", event_info[event_idx].id);
verbose("count_val is %d\n", count_val);
return 0;
}