diff options
Diffstat (limited to 'tools')
-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 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) 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. 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); } 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" }, |