diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-12 16:16:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-12 16:16:52 -0400 |
commit | 4ddbac98980fe0a42cf57af5d1032e024aced6a1 (patch) | |
tree | 341d152dc1f9427d70d5b1fadafca61d22baacbb /tools/perf | |
parent | 02a99ed6207e9a1d787bb360ef97de023c7edf4a (diff) | |
parent | 018df72dd01576ab199c6129233cdeaf1409958b (diff) |
Merge branch 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
perf_counter: Start documenting HAVE_PERF_COUNTERS requirements
perf_counter: Add forward/backward attribute ABI compatibility
perf record: Explicity program a default counter
perf_counter: Remove PERF_TYPE_RAW special casing
perf_counter: PERF_TYPE_HW_CACHE is a hardware counter too
powerpc, perf_counter: Fix performance counter event types
perf_counter/x86: Add a quirk for Atom processors
perf_counter tools: Remove one L1-data alias
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" }, |