diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-06-17 02:59:01 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-17 02:59:10 -0400 |
commit | cc4949e1fdade5d063e9f8783cf0e2cc92041ce5 (patch) | |
tree | 4023bd641bfe464efbde518fb504d6865c9df014 /tools/perf | |
parent | 28b4868820a56de661f54742ff91b78e12f1e582 (diff) | |
parent | 300df7dc89cc276377fc020704e34875d5c473b6 (diff) |
Merge branch 'linus' into x86/urgent
Merge reason: pull in latest to fix a bug in it.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-record.c | 7 | ||||
-rw-r--r-- | tools/perf/design.txt | 15 | ||||
-rw-r--r-- | tools/perf/perf.h | 5 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 2 |
4 files changed, 24 insertions, 5 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 29259e74dcfa..0f5771f615da 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -568,8 +568,11 @@ int cmd_record(int argc, const char **argv, const char *prefix) | |||
568 | if (!argc && target_pid == -1 && !system_wide) | 568 | if (!argc && target_pid == -1 && !system_wide) |
569 | usage_with_options(record_usage, options); | 569 | usage_with_options(record_usage, options); |
570 | 570 | ||
571 | if (!nr_counters) | 571 | if (!nr_counters) { |
572 | nr_counters = 1; | 572 | nr_counters = 1; |
573 | attrs[0].type = PERF_TYPE_HARDWARE; | ||
574 | attrs[0].config = PERF_COUNT_HW_CPU_CYCLES; | ||
575 | } | ||
573 | 576 | ||
574 | for (counter = 0; counter < nr_counters; counter++) { | 577 | for (counter = 0; counter < nr_counters; counter++) { |
575 | if (attrs[counter].sample_period) | 578 | if (attrs[counter].sample_period) |
diff --git a/tools/perf/design.txt b/tools/perf/design.txt index 860e116d979c..f71e0d245cba 100644 --- a/tools/perf/design.txt +++ b/tools/perf/design.txt | |||
@@ -440,3 +440,18 @@ by this process or by another, and doesn't affect any counters that | |||
440 | this process has created on other processes. It only enables or | 440 | this process has created on other processes. It only enables or |
441 | disables the group leaders, not any other members in the groups. | 441 | disables the group leaders, not any other members in the groups. |
442 | 442 | ||
443 | |||
444 | Arch requirements | ||
445 | ----------------- | ||
446 | |||
447 | If your architecture does not have hardware performance metrics, you can | ||
448 | still use the generic software counters based on hrtimers for sampling. | ||
449 | |||
450 | So to start with, in order to add HAVE_PERF_COUNTERS to your Kconfig, you | ||
451 | will need at least this: | ||
452 | - asm/perf_counter.h - a basic stub will suffice at first | ||
453 | - support for atomic64 types (and associated helper functions) | ||
454 | - set_perf_counter_pending() implemented | ||
455 | |||
456 | If your architecture does have hardware capabilities, you can override the | ||
457 | weak stub hw_perf_counter_init() to register hardware counters. | ||
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index af0a5046d743..87a1aca4a424 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -53,11 +53,12 @@ static inline unsigned long long rdclock(void) | |||
53 | _min1 < _min2 ? _min1 : _min2; }) | 53 | _min1 < _min2 ? _min1 : _min2; }) |
54 | 54 | ||
55 | static inline int | 55 | static inline int |
56 | sys_perf_counter_open(struct perf_counter_attr *attr_uptr, | 56 | sys_perf_counter_open(struct perf_counter_attr *attr, |
57 | pid_t pid, int cpu, int group_fd, | 57 | pid_t pid, int cpu, int group_fd, |
58 | unsigned long flags) | 58 | unsigned long flags) |
59 | { | 59 | { |
60 | return syscall(__NR_perf_counter_open, attr_uptr, pid, cpu, | 60 | attr->size = sizeof(*attr); |
61 | return syscall(__NR_perf_counter_open, attr, pid, cpu, | ||
61 | group_fd, flags); | 62 | group_fd, flags); |
62 | } | 63 | } |
63 | 64 | ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 9d5f1ca50e6f..5a72586e1df0 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -75,7 +75,7 @@ static char *sw_event_names[] = { | |||
75 | #define MAX_ALIASES 8 | 75 | #define MAX_ALIASES 8 |
76 | 76 | ||
77 | static char *hw_cache [][MAX_ALIASES] = { | 77 | static char *hw_cache [][MAX_ALIASES] = { |
78 | { "L1-data" , "l1-d", "l1d", "l1" }, | 78 | { "L1-data" , "l1-d", "l1d" }, |
79 | { "L1-instruction" , "l1-i", "l1i" }, | 79 | { "L1-instruction" , "l1-i", "l1i" }, |
80 | { "L2" , "l2" }, | 80 | { "L2" , "l2" }, |
81 | { "Data-TLB" , "dtlb", "d-tlb" }, | 81 | { "Data-TLB" , "dtlb", "d-tlb" }, |