perf/core improvements and fixes:

User visible:
 
 - 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:
 
 - 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>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVFCe6AAoJEBpxZoYYoA71IPQH/0GyVG3tGC34Zl0GDqQF8dbL
 skrDQpNaNMQ0lXRy4GGEp+wiOz2j5N5c22ArmZeUKMV0y5+LBv7H5BxzjCOgZXGn
 yGy6JxB0S8RcM+iTbMqS1OIbtFh/FISmsSFnWoTOzYFxT0uCCIPaG6R/cJMNMhza
 Udge/p8bbejeWaaKWUdyZkN1wH/c06hSOiaIQnn2vz3yiFCcfoLW746kYb2RI1tB
 qMZvoG9fPvT7cEW2dn/z12JcnjaQxLHlSCIy26+Y+cMo5DwjBQdwDaCUFofFFPi3
 QG9apo2CWQyUp96mB17IMHJG6QVh5Px0ZEvw2PLpYM3Y2KQM69eBDCU8qdPLQNI=
 =YOUs
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Ingo Molnar 2015-03-27 08:36:01 +01:00
commit 30fdaa6b11
9 changed files with 20 additions and 16 deletions

View File

@ -3615,7 +3615,7 @@ static const struct flag flags[] = {
{ "HRTIMER_RESTART", 1 },
};
static unsigned long long eval_flag(const char *flag)
static long long eval_flag(const char *flag)
{
int i;
@ -3631,7 +3631,7 @@ static unsigned long long eval_flag(const char *flag)
if (strcmp(flags[i].name, flag) == 0)
return flags[i].value;
return 0;
return -1LL;
}
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,
struct print_flag_sym *flag;
struct format_field *field;
struct printk_map *printk;
unsigned long long val, fval;
long long val, fval;
unsigned long addr;
char *str;
unsigned char *hex;
@ -3764,11 +3764,11 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
print = 0;
for (flag = arg->flags.flags; flag; flag = flag->next) {
fval = eval_flag(flag->value);
if (!val && !fval) {
if (!val && fval < 0) {
print_str_to_seq(s, format, len_arg, flag->str);
break;
}
if (fval && (val & fval) == fval) {
if (fval > 0 && (val & fval) == fval) {
if (print && arg->flags.delim)
trace_seq_puts(s, arg->flags.delim);
print_str_to_seq(s, format, len_arg, flag->str);

View File

@ -24,7 +24,7 @@ unexport MAKEFLAGS
# (To override it, run 'make JOBS=1' and similar.)
#
ifeq ($(JOBS),)
JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
JOBS := $(shell egrep -c '^processor|^CPU' /proc/cpuinfo 2>/dev/null)
ifeq ($(JOBS),0)
JOBS := 1
endif

View File

@ -161,8 +161,9 @@ try_again:
}
}
if (perf_evlist__apply_filters(evlist)) {
error("failed to set filter with %d (%s)\n", errno,
if (perf_evlist__apply_filters(evlist, &pos)) {
error("failed to set filter \"%s\" on event %s with %d (%s)\n",
pos->filter, perf_evsel__name(pos), errno,
strerror_r(errno, msg, sizeof(msg)));
rc = -1;
goto out;

View File

@ -684,8 +684,9 @@ static int __run_perf_stat(int argc, const char **argv)
unit_width = l;
}
if (perf_evlist__apply_filters(evsel_list)) {
error("failed to set filter with %d (%s)\n", errno,
if (perf_evlist__apply_filters(evsel_list, &counter)) {
error("failed to set filter \"%s\" on event %s with %d (%s)\n",
counter->filter, perf_evsel__name(counter), errno,
strerror_r(errno, msg, sizeof(msg)));
return -1;
}

View File

@ -1735,7 +1735,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel,
}
if (!trace->summary_only)
printed += trace__printf_interrupted_entry(trace, sample);
trace__printf_interrupted_entry(trace, sample);
ttrace->entry_time = sample->time;
msg = ttrace->entry_str;

View File

@ -29,7 +29,7 @@ static inline unsigned long long rdclock(void)
return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
}
#define MAX_NR_CPUS 256
#define MAX_NR_CPUS 1024
extern const char *input_name;
extern bool perf_host, perf_guest;

View File

@ -1050,7 +1050,7 @@ out_delete_threads:
return -1;
}
int perf_evlist__apply_filters(struct perf_evlist *evlist)
int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel)
{
struct perf_evsel *evsel;
int err = 0;
@ -1062,8 +1062,10 @@ int perf_evlist__apply_filters(struct perf_evlist *evlist)
continue;
err = perf_evsel__set_filter(evsel, ncpus, nthreads, evsel->filter);
if (err)
if (err) {
*err_evsel = evsel;
break;
}
}
return err;

View File

@ -152,7 +152,7 @@ static inline void perf_evlist__set_maps(struct perf_evlist *evlist,
}
int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target);
int perf_evlist__apply_filters(struct perf_evlist *evlist);
int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel);
void __perf_evlist__set_leader(struct list_head *list);
void perf_evlist__set_leader(struct perf_evlist *evlist);

View File

@ -1915,7 +1915,7 @@ u64 perf_evsel__intval(struct perf_evsel *evsel, struct perf_sample *sample,
value = *(u32 *)ptr;
break;
case 8:
value = *(u64 *)ptr;
memcpy(&value, ptr, sizeof(u64));
break;
default:
return 0;