From faafec1e61e61d350248af2a7e5f047606adab6e Mon Sep 17 00:00:00 2001 From: Yong Wang Date: Fri, 12 Jun 2009 11:17:06 +0800 Subject: perf_counter tools: Remove one L1-data alias Otherwise all L1-instruction aliases will be recognized as L1-data by strcasestr() when calling function parse_aliases. Signed-off-by: Yong Wang Cc: Peter Zijlstra Cc: Paul Mackerras LKML-Reference: <20090612031706.GA22126@ywang-moblin2.bj.intel.com> Signed-off-by: Ingo Molnar --- tools/perf/util/parse-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 9d5f1ca50e6..5a72586e1df 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -75,7 +75,7 @@ static char *sw_event_names[] = { #define MAX_ALIASES 8 static char *hw_cache [][MAX_ALIASES] = { - { "L1-data" , "l1-d", "l1d", "l1" }, + { "L1-data" , "l1-d", "l1d" }, { "L1-instruction" , "l1-i", "l1i" }, { "L2" , "l2" }, { "Data-TLB" , "dtlb", "d-tlb" }, -- cgit v1.2.3-18-g5258 From bbd36e5e6aa6f1757c84cdb406b6eb81686d14af Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Thu, 11 Jun 2009 23:11:50 +0200 Subject: perf record: Explicity program a default counter Up until now record has worked on the assumption that type=0, config=0 was a suitable configuration - which it is. Lets make this a little more explicit and more readable via the use of proper symbols. [ Impact: cleanup ] Signed-off-by: Peter Zijlstra Cc: Mike Galbraith Cc: Paul Mackerras Cc: Arnaldo Carvalho de Melo LKML-Reference: Signed-off-by: Ingo Molnar --- tools/perf/builtin-record.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 29259e74dcf..0f5771f615d 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) if (!argc && target_pid == -1 && !system_wide) usage_with_options(record_usage, options); - if (!nr_counters) - nr_counters = 1; + if (!nr_counters) { + nr_counters = 1; + attrs[0].type = PERF_TYPE_HARDWARE; + attrs[0].config = PERF_COUNT_HW_CPU_CYCLES; + } for (counter = 0; counter < nr_counters; counter++) { if (attrs[counter].sample_period) -- cgit v1.2.3-18-g5258 From 974802eaa1afdc87e00821df7020a2b3c6fee623 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Fri, 12 Jun 2009 12:46:55 +0200 Subject: perf_counter: Add forward/backward attribute ABI compatibility Provide for means of extending the perf_counter_attr in a 'natural' way. We allow growing the structure by appending fields at the end by specifying the full structure size inside it. When a new kernel sees a smaller (old) structure, it will 0 pad the tail. When an old kernel sees a larger (new) structure, it will verify the tail consists of 0s, otherwise fail. If we fail due to a size-mismatch, we return -E2BIG and write the kernel's native attribe size back into the provided structure. Furthermore, add some attribute verification, so that we'll fail counter creation when unknown bits are present (PERF_SAMPLE, PERF_FORMAT, or in the __reserved fields). (This ABI detail is introduced while keeping the existing syscall ABI.) Signed-off-by: Peter Zijlstra Cc: Mike Galbraith Cc: Paul Mackerras Cc: Arnaldo Carvalho de Melo LKML-Reference: Signed-off-by: Ingo Molnar --- tools/perf/perf.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/perf/perf.h b/tools/perf/perf.h index af0a5046d74..87a1aca4a42 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h @@ -53,11 +53,12 @@ static inline unsigned long long rdclock(void) _min1 < _min2 ? _min1 : _min2; }) static inline int -sys_perf_counter_open(struct perf_counter_attr *attr_uptr, +sys_perf_counter_open(struct perf_counter_attr *attr, pid_t pid, int cpu, int group_fd, unsigned long flags) { - return syscall(__NR_perf_counter_open, attr_uptr, pid, cpu, + attr->size = sizeof(*attr); + return syscall(__NR_perf_counter_open, attr, pid, cpu, group_fd, flags); } -- cgit v1.2.3-18-g5258 From 018df72dd01576ab199c6129233cdeaf1409958b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 12 Jun 2009 13:17:43 -0400 Subject: perf_counter: Start documenting HAVE_PERF_COUNTERS requirements Help out arch porters who want to support perf counters by listing some basic requirements. Signed-off-by: Mike Frysinger Cc: Peter Zijlstra Cc: Paul Mackerras LKML-Reference: <1244827063-24046-1-git-send-email-vapier@gentoo.org> Signed-off-by: Ingo Molnar --- tools/perf/design.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tools') diff --git a/tools/perf/design.txt b/tools/perf/design.txt index 860e116d979..f71e0d245cb 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 this process has created on other processes. It only enables or disables the group leaders, not any other members in the groups. + +Arch requirements +----------------- + +If your architecture does not have hardware performance metrics, you can +still use the generic software counters based on hrtimers for sampling. + +So to start with, in order to add HAVE_PERF_COUNTERS to your Kconfig, you +will need at least this: + - asm/perf_counter.h - a basic stub will suffice at first + - support for atomic64 types (and associated helper functions) + - set_perf_counter_pending() implemented + +If your architecture does have hardware capabilities, you can override the +weak stub hw_perf_counter_init() to register hardware counters. -- cgit v1.2.3-18-g5258