Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 245471
b: refs/heads/master
c: 1fc570a
h: refs/heads/master
i:
  245469: 44991e9
  245467: cef2576
  245463: e0045b0
  245455: 88ebd58
  245439: a6e7f35
v: v3
  • Loading branch information
Ingo Molnar committed Apr 26, 2011
1 parent 8940701 commit 3764e38
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 481f988a016f7a0327a5537bde4794349fc4625c
refs/heads/master: 1fc570ad89e55dc32dfa4dda1311948b38f26524
5 changes: 2 additions & 3 deletions trunk/tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ static struct perf_event_attr default_attrs[] = {
{ .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS },

{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_REFERENCES },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_MISSES },

};

Expand Down Expand Up @@ -468,7 +467,7 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg)
if (total)
ratio = avg * 100 / total;

fprintf(stderr, " # %8.3f %% of all branches", ratio);
fprintf(stderr, " # %5.2f %% of all branches ", ratio);

} else if (perf_evsel__match(evsel, HARDWARE, HW_CACHE_MISSES) &&
runtime_cacherefs_stats[cpu].n != 0) {
Expand Down
11 changes: 6 additions & 5 deletions trunk/tools/perf/util/parse-events.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ char debugfs_path[MAXPATHLEN];

static struct event_symbol event_symbols[] = {
{ CHW(CPU_CYCLES), "cpu-cycles", "cycles" },
{ CHW(STALLED_CYCLES), "stalled-cycles", "idle-cycles" },
{ CHW(INSTRUCTIONS), "instructions", "" },
{ CHW(CACHE_REFERENCES), "cache-references", "" },
{ CHW(CACHE_MISSES), "cache-misses", "" },
{ CHW(BRANCH_INSTRUCTIONS), "branch-instructions", "branches" },
{ CHW(BRANCH_MISSES), "branch-misses", "" },
{ CHW(BUS_CYCLES), "bus-cycles", "" },
{ CHW(STALLED_CYCLES), "stalled-cycles", "" },

{ CSW(CPU_CLOCK), "cpu-clock", "" },
{ CSW(TASK_CLOCK), "task-clock", "" },
Expand All @@ -54,9 +54,9 @@ static struct event_symbol event_symbols[] = {
#define __PERF_EVENT_FIELD(config, name) \
((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT)

#define PERF_EVENT_RAW(config) __PERF_EVENT_FIELD(config, RAW)
#define PERF_EVENT_RAW(config) __PERF_EVENT_FIELD(config, RAW)
#define PERF_EVENT_CONFIG(config) __PERF_EVENT_FIELD(config, CONFIG)
#define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE)
#define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE)
#define PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT)

static const char *hw_event_names[] = {
Expand All @@ -67,6 +67,7 @@ static const char *hw_event_names[] = {
"branches",
"branch-misses",
"bus-cycles",
"stalled-cycles",
};

static const char *sw_event_names[] = {
Expand Down Expand Up @@ -308,7 +309,7 @@ const char *__event_name(int type, u64 config)

switch (type) {
case PERF_TYPE_HARDWARE:
if (config < PERF_COUNT_HW_MAX)
if (config < PERF_COUNT_HW_MAX && hw_event_names[config])
return hw_event_names[config];
return "unknown-hardware";

Expand All @@ -334,7 +335,7 @@ const char *__event_name(int type, u64 config)
}

case PERF_TYPE_SOFTWARE:
if (config < PERF_COUNT_SW_MAX)
if (config < PERF_COUNT_SW_MAX && sw_event_names[config])
return sw_event_names[config];
return "unknown-software";

Expand Down

0 comments on commit 3764e38

Please sign in to comment.