diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-03-27 03:36:01 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-03-27 03:36:01 -0400 |
commit | 30fdaa6b11834fc19656c6127a50229ea42ec27b (patch) | |
tree | 20f626ea02fb0590a0946243008f069993bc72d2 | |
parent | baa5a7bc5dd069bb37de9c8bdb5ea7f4e2e939e9 (diff) | |
parent | 7c27f78a297b54c3c2f5075cb15d33431b7f6333 (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
User visible changes:
- Show the first event with an invalid filter (David Ahern, Arnaldo Carvalho de Melo)
- Fix garbage output when intermixing syscalls from different threads in 'perf trace' (Arnaldo Carvalho de Melo)
- Fix 'perf timechart' SIBGUS error on sparc64 (David Ahern)
Infrastructure changes:
- Set JOBS based on CPU or processor, making it work on SPARC, where
/proc/cpuinfo has "CPU", not "processor" (David Ahern)
- Zero should not be considered "not found" in libtraceevent's eval_flag() (Steven Rostedt)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | tools/lib/traceevent/event-parse.c | 10 | ||||
-rw-r--r-- | tools/perf/Makefile | 2 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-stat.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-trace.c | 2 | ||||
-rw-r--r-- | tools/perf/perf.h | 2 | ||||
-rw-r--r-- | tools/perf/util/evlist.c | 6 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 2 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 2 |
9 files changed, 20 insertions, 16 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index b6d11eea8a57..6d31b6419d37 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
@@ -3615,7 +3615,7 @@ static const struct flag flags[] = { | |||
3615 | { "HRTIMER_RESTART", 1 }, | 3615 | { "HRTIMER_RESTART", 1 }, |
3616 | }; | 3616 | }; |
3617 | 3617 | ||
3618 | static unsigned long long eval_flag(const char *flag) | 3618 | static long long eval_flag(const char *flag) |
3619 | { | 3619 | { |
3620 | int i; | 3620 | int i; |
3621 | 3621 | ||
@@ -3631,7 +3631,7 @@ static unsigned long long eval_flag(const char *flag) | |||
3631 | if (strcmp(flags[i].name, flag) == 0) | 3631 | if (strcmp(flags[i].name, flag) == 0) |
3632 | return flags[i].value; | 3632 | return flags[i].value; |
3633 | 3633 | ||
3634 | return 0; | 3634 | return -1LL; |
3635 | } | 3635 | } |
3636 | 3636 | ||
3637 | static void print_str_to_seq(struct trace_seq *s, const char *format, | 3637 | static void print_str_to_seq(struct trace_seq *s, const char *format, |
@@ -3705,7 +3705,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
3705 | struct print_flag_sym *flag; | 3705 | struct print_flag_sym *flag; |
3706 | struct format_field *field; | 3706 | struct format_field *field; |
3707 | struct printk_map *printk; | 3707 | struct printk_map *printk; |
3708 | unsigned long long val, fval; | 3708 | long long val, fval; |
3709 | unsigned long addr; | 3709 | unsigned long addr; |
3710 | char *str; | 3710 | char *str; |
3711 | unsigned char *hex; | 3711 | unsigned char *hex; |
@@ -3764,11 +3764,11 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
3764 | print = 0; | 3764 | print = 0; |
3765 | for (flag = arg->flags.flags; flag; flag = flag->next) { | 3765 | for (flag = arg->flags.flags; flag; flag = flag->next) { |
3766 | fval = eval_flag(flag->value); | 3766 | fval = eval_flag(flag->value); |
3767 | if (!val && !fval) { | 3767 | if (!val && fval < 0) { |
3768 | print_str_to_seq(s, format, len_arg, flag->str); | 3768 | print_str_to_seq(s, format, len_arg, flag->str); |
3769 | break; | 3769 | break; |
3770 | } | 3770 | } |
3771 | if (fval && (val & fval) == fval) { | 3771 | if (fval > 0 && (val & fval) == fval) { |
3772 | if (print && arg->flags.delim) | 3772 | if (print && arg->flags.delim) |
3773 | trace_seq_puts(s, arg->flags.delim); | 3773 | trace_seq_puts(s, arg->flags.delim); |
3774 | print_str_to_seq(s, format, len_arg, flag->str); | 3774 | print_str_to_seq(s, format, len_arg, flag->str); |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index d5020aeb5626..c699dc35eef9 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -24,7 +24,7 @@ unexport MAKEFLAGS | |||
24 | # (To override it, run 'make JOBS=1' and similar.) | 24 | # (To override it, run 'make JOBS=1' and similar.) |
25 | # | 25 | # |
26 | ifeq ($(JOBS),) | 26 | ifeq ($(JOBS),) |
27 | JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null) | 27 | JOBS := $(shell egrep -c '^processor|^CPU' /proc/cpuinfo 2>/dev/null) |
28 | ifeq ($(JOBS),0) | 28 | ifeq ($(JOBS),0) |
29 | JOBS := 1 | 29 | JOBS := 1 |
30 | endif | 30 | endif |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 5a2ff510b75b..18aad239b401 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -161,8 +161,9 @@ try_again: | |||
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | if (perf_evlist__apply_filters(evlist)) { | 164 | if (perf_evlist__apply_filters(evlist, &pos)) { |
165 | error("failed to set filter with %d (%s)\n", errno, | 165 | error("failed to set filter \"%s\" on event %s with %d (%s)\n", |
166 | pos->filter, perf_evsel__name(pos), errno, | ||
166 | strerror_r(errno, msg, sizeof(msg))); | 167 | strerror_r(errno, msg, sizeof(msg))); |
167 | rc = -1; | 168 | rc = -1; |
168 | goto out; | 169 | goto out; |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index d4d1b77da0bd..f7b8218785f6 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -684,8 +684,9 @@ static int __run_perf_stat(int argc, const char **argv) | |||
684 | unit_width = l; | 684 | unit_width = l; |
685 | } | 685 | } |
686 | 686 | ||
687 | if (perf_evlist__apply_filters(evsel_list)) { | 687 | if (perf_evlist__apply_filters(evsel_list, &counter)) { |
688 | error("failed to set filter with %d (%s)\n", errno, | 688 | error("failed to set filter \"%s\" on event %s with %d (%s)\n", |
689 | counter->filter, perf_evsel__name(counter), errno, | ||
689 | strerror_r(errno, msg, sizeof(msg))); | 690 | strerror_r(errno, msg, sizeof(msg))); |
690 | return -1; | 691 | return -1; |
691 | } | 692 | } |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 001c6ae9a1b1..bcc98ce3e5b8 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -1735,7 +1735,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, | |||
1735 | } | 1735 | } |
1736 | 1736 | ||
1737 | if (!trace->summary_only) | 1737 | if (!trace->summary_only) |
1738 | printed += trace__printf_interrupted_entry(trace, sample); | 1738 | trace__printf_interrupted_entry(trace, sample); |
1739 | 1739 | ||
1740 | ttrace->entry_time = sample->time; | 1740 | ttrace->entry_time = sample->time; |
1741 | msg = ttrace->entry_str; | 1741 | msg = ttrace->entry_str; |
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 1caa70a4a9e1..c38a085a5571 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -29,7 +29,7 @@ static inline unsigned long long rdclock(void) | |||
29 | return ts.tv_sec * 1000000000ULL + ts.tv_nsec; | 29 | return ts.tv_sec * 1000000000ULL + ts.tv_nsec; |
30 | } | 30 | } |
31 | 31 | ||
32 | #define MAX_NR_CPUS 256 | 32 | #define MAX_NR_CPUS 1024 |
33 | 33 | ||
34 | extern const char *input_name; | 34 | extern const char *input_name; |
35 | extern bool perf_host, perf_guest; | 35 | extern bool perf_host, perf_guest; |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 8d0b62361129..82bf224bbee9 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -1050,7 +1050,7 @@ out_delete_threads: | |||
1050 | return -1; | 1050 | return -1; |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | int perf_evlist__apply_filters(struct perf_evlist *evlist) | 1053 | int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel) |
1054 | { | 1054 | { |
1055 | struct perf_evsel *evsel; | 1055 | struct perf_evsel *evsel; |
1056 | int err = 0; | 1056 | int err = 0; |
@@ -1062,8 +1062,10 @@ int perf_evlist__apply_filters(struct perf_evlist *evlist) | |||
1062 | continue; | 1062 | continue; |
1063 | 1063 | ||
1064 | err = perf_evsel__set_filter(evsel, ncpus, nthreads, evsel->filter); | 1064 | err = perf_evsel__set_filter(evsel, ncpus, nthreads, evsel->filter); |
1065 | if (err) | 1065 | if (err) { |
1066 | *err_evsel = evsel; | ||
1066 | break; | 1067 | break; |
1068 | } | ||
1067 | } | 1069 | } |
1068 | 1070 | ||
1069 | return err; | 1071 | return err; |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index f07c984465f0..fb19c47b8aac 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -152,7 +152,7 @@ static inline void perf_evlist__set_maps(struct perf_evlist *evlist, | |||
152 | } | 152 | } |
153 | 153 | ||
154 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target); | 154 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target); |
155 | int perf_evlist__apply_filters(struct perf_evlist *evlist); | 155 | int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel); |
156 | 156 | ||
157 | void __perf_evlist__set_leader(struct list_head *list); | 157 | void __perf_evlist__set_leader(struct list_head *list); |
158 | void perf_evlist__set_leader(struct perf_evlist *evlist); | 158 | void perf_evlist__set_leader(struct perf_evlist *evlist); |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index bb4eff28869e..358e5954baa8 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -1915,7 +1915,7 @@ u64 perf_evsel__intval(struct perf_evsel *evsel, struct perf_sample *sample, | |||
1915 | value = *(u32 *)ptr; | 1915 | value = *(u32 *)ptr; |
1916 | break; | 1916 | break; |
1917 | case 8: | 1917 | case 8: |
1918 | value = *(u64 *)ptr; | 1918 | memcpy(&value, ptr, sizeof(u64)); |
1919 | break; | 1919 | break; |
1920 | default: | 1920 | default: |
1921 | return 0; | 1921 | return 0; |