perf/core improvements and fixes
From: Arnaldo Carvalho de Melo <[email protected]>
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit 46d525eae2a076adfde92dca1db12d9a3b8ad8bb:
perf test: Update command line callchain attribute tests (2013-11-01 10:42:57 -0300)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-urgent-for-mingo
for you to fetch changes up to 46d525eae2a076adfde92dca1db12d9a3b8ad8bb:
perf test: Update command line callchain attribute tests (2013-11-01 10:42:57 -0300)
----------------------------------------------------------------
perf/urgent fixes:
. Fix command line callchain attribute tests to handle the new
-g/--call-chain semantics.
. Remove cast of non-variadic function to variadic, fixing perf output
on armhf arch. Fix from Michael Hudson-Doyle.
. Fix 32-bit building of 'perf bench', from Wei Yang.
----------------------------------------------------------------
PATCH 1/29 perf probe: Fix typo
From: Arnaldo Carvalho de Melo <[email protected]>
s/tyep/type/g.
--- tools/perf/util/probe-finder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/probe-finder.c +1 -1
@@ -583,7 +583,7 @@ static int convert_variable_fields(Dwarf_Die *vr_die, const char *varname, }if (die_find_member (&type, field->name, die_mem) ==NULL ) { -pr_warning ("%s(tyep:%s) has no member %s.\n" , varname, +pr_warning ("%s(type:%s) has no member %s.\n" , varname,dwarf_diename (&type), field->name);return -EINVAL ; }
Signature · 1 line
1.8.1.4
PATCH 2/29 perf tools: Add missing data.h into LIB_H headers
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Adding missing data.h into LIB_H headers so the build could keep up with its changes.
--- tools/perf/Makefile.perf | 1 + 1 file changed, 1 insertion(+)
tools/perf/Makefile.perf +1 -0
@@ -295,6 +295,7 @@ LIB_H += ui/helpline.h LIB_H += ui/progress.h LIB_H += ui/util.h LIB_H += ui/ui.h +LIB_H += util/data.h LIB_OBJS += $(OUTPUT)util/abspath.o LIB_OBJS += $(OUTPUT)util/alias.o
Signature · 1 line
1.8.1.4
PATCH 3/29 perf tools: Use an accessor to read thread comm
In reply to Arnaldo Carvalho de MeloFrom: Frederic Weisbecker <[email protected]>
As the thread comm is going to be implemented by way of a more complicated data structure than just a pointer to a string from the thread struct, convert the readers of comm to use an accessor instead of accessing it directly.
The accessor will be later overriden to support an enhanced comm implementation.
--- tools/perf/builtin-kmem.c | 2 +- tools/perf/builtin-lock.c | 2 +- tools/perf/builtin-sched.c | 16 ++++++++-------- tools/perf/builtin-script.c | 6 +++--- tools/perf/tests/hists_link.c | 2 +- tools/perf/ui/browsers/hists.c | 10 +++++----- tools/perf/util/event.c | 4 ++-- tools/perf/util/scripting-engines/trace-event-perl.c | 2 +- tools/perf/util/scripting-engines/trace-event-python.c | 4 ++-- tools/perf/util/sort.c | 11 ++++++----- tools/perf/util/thread.c | 7 ++++++- tools/perf/util/thread.h | 1 + 12 files changed, 37 insertions(+), 30 deletions(-)
tools/perf/builtin-kmem.c +1 -1
@@ -315,7 +315,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,return -1 ; } -dump_printf (" ... thread: %s:%d\n" , thread->comm, thread->tid); +dump_printf (" ... thread: %s:%d\n" ,thread__comm_str (thread), thread->tid);if (evsel->handler.func !=NULL ) {tracepoint_handler f = evsel->handler.func;
tools/perf/builtin-lock.c +1 -1
@@ -767,7 +767,7 @@ static void dump_threads(void)while (node) { st = container_of(node, struct thread_stat, rb); t =perf_session__findnew (session, st->tid); -pr_info ("%10d: %s\n" , st->tid, t->comm); +pr_info ("%10d: %s\n" , st->tid,thread__comm_str (t)); node =rb_next (node); }; }
tools/perf/builtin-sched.c +8 -8
@@ -737,12 +737,12 @@ static int replay_fork_event(struct perf_sched *sched,if (verbose) {printf ("fork event\n" ); -printf ("... parent: %s/%d\n" , parent->comm, parent->tid); -printf ("... child: %s/%d\n" , child->comm, child->tid); +printf ("... parent: %s/%d\n" ,thread__comm_str (parent), parent->tid); +printf ("... child: %s/%d\n" ,thread__comm_str (child), child->tid); } -register_pid (sched, parent->tid, parent->comm); -register_pid (sched, child->tid, child->comm); +register_pid (sched, parent->tid,thread__comm_str (parent)); +register_pid (sched, child->tid,thread__comm_str (child));return 0 ; }
@@ -1077,7 +1077,7 @@ static int latency_migrate_task_event(struct perf_sched *sched,if (!atoms) {if (thread_atoms_insert (sched, migrant))return -1 ; -register_pid (sched, migrant->tid, migrant->comm); +register_pid (sched, migrant->tid,thread__comm_str (migrant)); atoms =thread_atoms_search (&sched->atom_root, migrant, &sched->cmp_pid);if (!atoms) {pr_err ("migration-event: Internal tree error" );
@@ -1111,13 +1111,13 @@ static void output_lat_thread(struct perf_sched *sched, struct work_atoms *work_/* * Ignore idle threads: */ -if (!strcmp (work_list->thread->comm,"swapper" )) +if (!strcmp (thread__comm_str (work_list->thread),"swapper" ))return ; sched->all_runtime += work_list->total_runtime; sched->all_count += work_list->nb_atoms; - ret =printf (" %s:%d " , work_list->thread->comm, work_list->thread->tid); + ret =printf (" %s:%d " ,thread__comm_str (work_list->thread), work_list->thread->tid);for (i =0 ; i <24 - ret; i++)printf (" " );
@@ -1334,7 +1334,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel,printf (" %12.6f secs " , (double )timestamp/1e9 );if (new_shortname) {printf ("%s => %s:%d\n" , - sched_in->shortname, sched_in->comm, sched_in->tid); + sched_in->shortname,thread__comm_str (sched_in), sched_in->tid); }else {printf ("\n" ); }
tools/perf/builtin-script.c +3 -3
@@ -291,11 +291,11 @@ static void print_sample_start(struct perf_sample *sample,if (PRINT_FIELD (COMM )) {if (latency_format) -printf ("%8.8s " , thread->comm); +printf ("%8.8s " ,thread__comm_str (thread));else if (PRINT_FIELD (IP ) && symbol_conf.use_callchain) -printf ("%s " , thread->comm); +printf ("%s " ,thread__comm_str (thread));else -printf ("%16s " , thread->comm); +printf ("%16s " ,thread__comm_str (thread)); }if (PRINT_FIELD (PID ) &&PRINT_FIELD (TID ))
tools/perf/tests/hists_link.c +1 -1
@@ -421,7 +421,7 @@ static void print_hists(struct hists *hists) he = rb_entry(node, struct hist_entry, rb_node_in);pr_info ("%2d: entry: %-8s [%-8s] %20s: period = %" PRIu64"\n" , - i, he->thread->comm, he->ms.map->dso->short_name, + i,thread__comm_str (he->thread), he->ms.map->dso->short_name, he->ms.sym->name, he->stat.period); i++;
tools/perf/ui/browsers/hists.c +5 -5
@@ -1255,7 +1255,7 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size,if (thread) printed +=scnprintf (bf + printed, size - printed,", Thread: %s(%d)" , - (thread->comm_set ? thread->comm :"" ), + (thread->comm_set ?thread__comm_str (thread) :"" ), thread->tid);if (dso) printed += scnprintf(bf + printed, size - printed,
@@ -1578,7 +1578,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,if (thread !=NULL &&asprintf (&options[nr_options],"Zoom %s %s(%d) thread" , (browser->hists->thread_filter ?"out of" :"into" ), - (thread->comm_set ? thread->comm :"" ), + (thread->comm_set ?thread__comm_str (thread) :"" ), thread->tid) >0 ) zoom_thread = nr_options++;
@@ -1598,7 +1598,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,struct symbol *sym;if (asprintf (&options[nr_options],"Run scripts for samples of thread [%s]" , - browser->he_selection->thread->comm) >0 ) +thread__comm_str (browser->he_selection->thread)) >0 ) scripts_comm = nr_options++; sym = browser->he_selection->ms.sym;
@@ -1701,7 +1701,7 @@ zoom_out_thread: sort_thread.elide = false; }else {ui_helpline__fpush ("To zoom out press <- or -> + \"Zoom out of %s(%d) thread\"" , - thread->comm_set ? thread->comm :"" , + thread->comm_set ?thread__comm_str (thread) :"" , thread->tid); browser->hists->thread_filter = thread; sort_thread.elide = true;
@@ -1717,7 +1717,7 @@ do_scripts:memset (script_opt,0 ,64 );if (choice == scripts_comm) -sprintf (script_opt," -c %s " , browser->he_selection->thread->comm); +sprintf (script_opt," -c %s " ,thread__comm_str (browser->he_selection->thread));if (choice == scripts_symbol)sprintf (script_opt," -S %s " , browser->he_selection->ms.sym->name);
tools/perf/util/event.c +2 -2
@@ -721,10 +721,10 @@ int perf_event__preprocess_sample(const union perf_event *event,return -1 ;if (symbol_conf.comm_list && - !strlist__has_entry (symbol_conf.comm_list, thread->comm)) + !strlist__has_entry (symbol_conf.comm_list,thread__comm_str (thread))) goto out_filtered; -dump_printf (" ... thread: %s:%d\n" , thread->comm, thread->tid); +dump_printf (" ... thread: %s:%d\n" ,thread__comm_str (thread), thread->tid);/* * Have we already created the kernel maps for this machine? *
tools/perf/util/scripting-engines/trace-event-perl.c +1 -1
@@ -273,7 +273,7 @@ static void perl_process_tracepoint(union perf_event *perf_event __maybe_unused,int cpu = sample->cpu;void *data = sample->raw_data;unsigned long long nsecs = sample->time; -char *comm = thread->comm; +const char *comm =thread__comm_str (thread); dSP;
tools/perf/util/scripting-engines/trace-event-python.c +2 -2
@@ -250,7 +250,7 @@ static void python_process_tracepoint(union perf_event *perf_eventint cpu = sample->cpu;void *data = sample->raw_data;unsigned long long nsecs = sample->time; -char *comm = thread->comm; +const char *comm =thread__comm_str (thread); t =PyTuple_New (MAX_FIELDS );if (!t)
@@ -389,7 +389,7 @@ static void python_process_general_event(union perf_event *perf_eventpydict_set_item_string_decref (dict,"raw_buf" ,PyString_FromStringAndSize ( (const char *)sample->raw_data, sample->raw_size));pydict_set_item_string_decref (dict,"comm" , -PyString_FromString (thread->comm)); +PyString_FromString (thread__comm_str (thread)));if (al->map) {pydict_set_item_string_decref (dict,"dso" ,PyString_FromString (al->map->dso->name));
tools/perf/util/sort.c +6 -5
@@ -42,7 +42,7 @@ static int repsep_snprintf(char *bf, size_t size, const char *fmt, ...)return n; } -static int64_t cmp_null (void *l,void *r) +static int64_t cmp_null (const void *l,const void *r) {if (!l && !r)return 0 ;
@@ -63,8 +63,9 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)static int hist_entry__thread_snprintf (struct hist_entry *he,char *bf,size_t size,unsigned int width) { +const char *comm =thread__comm_str (he->thread);return repsep_snprintf (bf, size,"%*s:%5d" , width -6 , - he->thread->comm ?:"" , he->thread->tid); + comm ?:"" , he->thread->tid); }struct sort_entry sort_thread = {
@@ -85,8 +86,8 @@ sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)static int64_t sort__comm_collapse (struct hist_entry *left,struct hist_entry *right) { -char *comm_l = left->thread->comm; -char *comm_r = right->thread->comm; +const char *comm_l =thread__comm_str (left->thread); +const char *comm_r =thread__comm_str (right->thread);if (!comm_l || !comm_r)return cmp_null (comm_l, comm_r);
@@ -97,7 +98,7 @@ sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)static int hist_entry__comm_snprintf (struct hist_entry *he,char *bf,size_t size,unsigned int width) { -return repsep_snprintf (bf, size,"%*s" , width, he->thread->comm); +return repsep_snprintf (bf, size,"%*s" , width,thread__comm_str (he->thread)); }struct sort_entry sort_comm = {
tools/perf/util/thread.c +6 -1
@@ -45,6 +45,11 @@ int thread__set_comm(struct thread *thread, const char *comm)return err; } +const char *thread__comm_str (const struct thread *thread) +{ +return thread->comm; +} +int thread__comm_len (struct thread *thread) {if (!thread->comm_len) {
@@ -58,7 +63,7 @@ int thread__comm_len(struct thread *thread)size_t thread__fprintf (struct thread *thread,FILE *fp) { -return fprintf (fp,"Thread %d %s\n" , thread->tid, thread->comm) + +return fprintf (fp,"Thread %d %s\n" , thread->tid,thread__comm_str (thread)) +map_groups__fprintf (&thread->mg, verbose, fp); }
tools/perf/util/thread.h +1 -0
@@ -35,6 +35,7 @@ static inline void thread__exited(struct thread *thread)int thread__set_comm (struct thread *self,const char *comm);int thread__comm_len (struct thread *self); +const char *thread__comm_str (const struct thread *thread);void thread__insert_map (struct thread *self,struct map *map);int thread__fork (struct thread *self,struct thread *parent);size_t thread__fprintf (struct thread *thread,FILE *fp);
Signature · 1 line
1.8.1.4
PATCH 4/29 perf tools: Add time argument on COMM setting
In reply to Arnaldo Carvalho de MeloFrom: Frederic Weisbecker <[email protected]>
This way we can later delimit a lifecycle for the COMM and map a hist to a precise COMM:timeslice couple.
PERF_RECORD_COMM and PERF_RECORD_FORK events that don't have PERF_SAMPLE_TIME samples can only send 0 value as a timestamp and thus should overwrite any previous COMM on a given thread because there is no sensible way to keep track of all the comms lifecycles in a thread without time informations.
--- tools/perf/builtin-top.c | 2 +- tools/perf/builtin-trace.c | 12 ++++++------ tools/perf/tests/code-reading.c | 2 +- tools/perf/tests/hists_link.c | 4 ++-- tools/perf/util/event.c | 28 ++++++++++++++-------------- tools/perf/util/machine.c | 39 ++++++++++++++++++++++----------------- tools/perf/util/machine.h | 21 ++++++++++++++------- tools/perf/util/session.c | 2 +- tools/perf/util/thread.c | 6 ++++-- tools/perf/util/thread.h | 4 ++-- 10 files changed, 67 insertions(+), 53 deletions(-)
tools/perf/builtin-top.c +1 -1
@@ -856,7 +856,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) &sample, machine); }else if (event->header.type <PERF_RECORD_MAX ) {hists__inc_nr_events (&evsel->hists, event->header.type); -machine__process_event (machine, event); +machine__process_event (machine, event, &sample); }else ++session->stats.nr_unknown_events; next_event:
tools/perf/builtin-trace.c +6 -6
@@ -1122,7 +1122,7 @@ static size_t trace__fprintf_entry_head(struct trace *trace, struct thread *thre }static int trace__process_event (struct trace *trace,struct machine *machine, -union perf_event *event) +union perf_event *event,struct perf_sample *sample) {int ret =0 ;
@@ -1130,9 +1130,9 @@ static int trace__process_event(struct trace *trace, struct machine *machine,case PERF_RECORD_LOST :color_fprintf (trace->output,PERF_COLOR_RED ,"LOST %" PRIu64" events!\n" , event->lost.lost); - ret =machine__process_lost_event (machine, event); + ret =machine__process_lost_event (machine, event, sample);default : - ret =machine__process_event (machine, event); + ret =machine__process_event (machine, event, sample);break ; }
@@ -1141,11 +1141,11 @@ static int trace__process_event(struct trace *trace, struct machine *machine,static int trace__tool_process (struct perf_tool *tool,union perf_event *event, -struct perf_sample *sample__maybe_unused , +struct perf_sample *sample,struct machine *machine) { struct trace *trace = container_of(tool, struct trace, tool); -return trace__process_event (trace, machine, event); +return trace__process_event (trace, machine, event, sample); }static int trace__symbols_init (struct trace *trace,struct perf_evlist *evlist)
@@ -1751,7 +1751,7 @@ again: trace->base_time = sample.time;if (type !=PERF_RECORD_SAMPLE ) { -trace__process_event (trace, trace->host, event); +trace__process_event (trace, trace->host, event, &sample);continue ; }
tools/perf/tests/code-reading.c +1 -1
@@ -276,7 +276,7 @@ static int process_event(struct machine *machine, struct perf_evlist *evlist,return process_sample_event (machine, evlist, event, state);if (event->header.type <PERF_RECORD_MAX ) -return machine__process_event (machine, event); +return machine__process_event (machine, event,NULL );return 0 ; }
tools/perf/tests/hists_link.c +2 -2
@@ -93,7 +93,7 @@ static struct machine *setup_fake_machine(struct machines *machines)if (thread ==NULL ) goto out; -thread__set_comm (thread, fake_threads[i].comm); +thread__set_comm (thread, fake_threads[i].comm,0 ); }for (i =0 ; i <ARRAY_SIZE (fake_mmap_info); i++) {
@@ -110,7 +110,7 @@ static struct machine *setup_fake_machine(struct machines *machines)strcpy (fake_mmap_event.mmap.filename, fake_mmap_info[i].filename); -machine__process_mmap_event (machine, &fake_mmap_event); +machine__process_mmap_event (machine, &fake_mmap_event,NULL ); }for (i =0 ; i <ARRAY_SIZE (fake_symbols); i++) {
tools/perf/util/event.c +14 -14
@@ -512,18 +512,18 @@ size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp)int perf_event__process_comm (struct perf_tool *tool__maybe_unused ,union perf_event *event, -struct perf_sample *sample__maybe_unused , +struct perf_sample *sample,struct machine *machine) { -return machine__process_comm_event (machine, event); +return machine__process_comm_event (machine, event, sample); }int perf_event__process_lost (struct perf_tool *tool__maybe_unused ,union perf_event *event, -struct perf_sample *sample__maybe_unused , +struct perf_sample *sample,struct machine *machine) { -return machine__process_lost_event (machine, event); +return machine__process_lost_event (machine, event, sample); }size_t perf_event__fprintf_mmap (union perf_event *event,FILE *fp)
@@ -546,18 +546,18 @@ size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp)int perf_event__process_mmap (struct perf_tool *tool__maybe_unused ,union perf_event *event, -struct perf_sample *sample__maybe_unused , +struct perf_sample *sample,struct machine *machine) { -return machine__process_mmap_event (machine, event); +return machine__process_mmap_event (machine, event, sample); }int perf_event__process_mmap2 (struct perf_tool *tool__maybe_unused ,union perf_event *event, -struct perf_sample *sample__maybe_unused , +struct perf_sample *sample,struct machine *machine) { -return machine__process_mmap2_event (machine, event); +return machine__process_mmap2_event (machine, event, sample); }size_t perf_event__fprintf_task (union perf_event *event,FILE *fp)
@@ -569,18 +569,18 @@ size_t perf_event__fprintf_task(union perf_event *event, FILE *fp)int perf_event__process_fork (struct perf_tool *tool__maybe_unused ,union perf_event *event, -struct perf_sample *sample__maybe_unused , +struct perf_sample *sample,struct machine *machine) { -return machine__process_fork_event (machine, event); +return machine__process_fork_event (machine, event, sample); }int perf_event__process_exit (struct perf_tool *tool__maybe_unused ,union perf_event *event, -struct perf_sample *sample__maybe_unused , +struct perf_sample *sample,struct machine *machine) { -return machine__process_exit_event (machine, event); +return machine__process_exit_event (machine, event, sample); }size_t perf_event__fprintf (union perf_event *event,FILE *fp)
@@ -611,10 +611,10 @@ size_t perf_event__fprintf(union perf_event *event, FILE *fp)int perf_event__process (struct perf_tool *tool__maybe_unused ,union perf_event *event, -struct perf_sample *sample__maybe_unused , +struct perf_sample *sample,struct machine *machine) { -return machine__process_event (machine, event); +return machine__process_event (machine, event, sample); } void thread__find_addr_map(struct thread *self,
tools/perf/util/machine.c +22 -17
@@ -40,7 +40,7 @@ int machine__init(struct machine *machine, const char *root_dir, pid_t pid)return -ENOMEM ;snprintf (comm,sizeof (comm),"[guest/%d]" , pid); -thread__set_comm (thread, comm); +thread__set_comm (thread, comm,0 ); }return 0 ;
@@ -331,7 +331,8 @@ struct thread *machine__find_thread(struct machine *machine, pid_t tid)return __machine__findnew_thread (machine,0 , tid, false); } -int machine__process_comm_event (struct machine *machine,union perf_event *event) +int machine__process_comm_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample) { struct thread *thread = machine__findnew_thread(machine, event->comm.pid,
@@ -340,7 +341,7 @@ int machine__process_comm_event(struct machine *machine, union perf_event *eventif (dump_trace)perf_event__fprintf_comm (event, stdout); -if (thread ==NULL ||thread__set_comm (thread, event->comm.comm)) { +if (thread ==NULL ||thread__set_comm (thread, event->comm.comm, sample->time)) {dump_printf ("problem processing PERF_RECORD_COMM, skipping event.\n" );return -1 ; }
@@ -349,7 +350,7 @@ int machine__process_comm_event(struct machine *machine, union perf_event *event }int machine__process_lost_event (struct machine *machine__maybe_unused , -union perf_event *event) +union perf_event *event,struct perf_sample *sample__maybe_unused ) {dump_printf (": id:%" PRIu64": lost:%" PRIu64"\n" , event->lost.id, event->lost.lost);
@@ -984,7 +985,8 @@ out_problem: }int machine__process_mmap2_event (struct machine *machine, -union perf_event *event) +union perf_event *event, +struct perf_sample *sample__maybe_unused ) {u8 cpumode = event->header.misc &PERF_RECORD_MISC_CPUMODE_MASK ;struct thread *thread;
@@ -1031,7 +1033,8 @@ out_problem:return 0 ; } -int machine__process_mmap_event (struct machine *machine,union perf_event *event) +int machine__process_mmap_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample__maybe_unused ) {u8 cpumode = event->header.misc &PERF_RECORD_MISC_CPUMODE_MASK ;struct thread *thread;
@@ -1088,7 +1091,8 @@ static void machine__remove_thread(struct machine *machine, struct thread *th)list_add_tail (&th->node, &machine->dead_threads); } -int machine__process_fork_event (struct machine *machine,union perf_event *event) +int machine__process_fork_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample) {struct thread *thread =machine__find_thread (machine, event->fork.tid); struct thread *parent = machine__findnew_thread(machine,
@@ -1105,7 +1109,7 @@ int machine__process_fork_event(struct machine *machine, union perf_event *eventperf_event__fprintf_task (event, stdout);if (thread ==NULL || parent ==NULL || -thread__fork (thread, parent) <0 ) { +thread__fork (thread, parent, sample->time) <0 ) {dump_printf ("problem processing PERF_RECORD_FORK, skipping event.\n" );return -1 ; }
@@ -1113,8 +1117,8 @@ int machine__process_fork_event(struct machine *machine, union perf_event *eventreturn 0 ; } -int machine__process_exit_event (struct machine *machine__maybe_unused , -union perf_event *event) +int machine__process_exit_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample__maybe_unused ) {struct thread *thread =machine__find_thread (machine, event->fork.tid);
@@ -1127,23 +1131,24 @@ int machine__process_exit_event(struct machine *machine __maybe_unused,return 0 ; } -int machine__process_event (struct machine *machine,union perf_event *event) +int machine__process_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample) {int ret;switch (event->header.type) {case PERF_RECORD_COMM : - ret =machine__process_comm_event (machine, event);break ; + ret =machine__process_comm_event (machine, event, sample);break ;case PERF_RECORD_MMAP : - ret =machine__process_mmap_event (machine, event);break ; + ret =machine__process_mmap_event (machine, event, sample);break ;case PERF_RECORD_MMAP2 : - ret =machine__process_mmap2_event (machine, event);break ; + ret =machine__process_mmap2_event (machine, event, sample);break ;case PERF_RECORD_FORK : - ret =machine__process_fork_event (machine, event);break ; + ret =machine__process_fork_event (machine, event, sample);break ;case PERF_RECORD_EXIT : - ret =machine__process_exit_event (machine, event);break ; + ret =machine__process_exit_event (machine, event, sample);break ;case PERF_RECORD_LOST : - ret =machine__process_lost_event (machine, event);break ; + ret =machine__process_lost_event (machine, event, sample);break ;default : ret =-1 ;break ;
tools/perf/util/machine.h +14 -7
@@ -40,13 +40,20 @@ struct map *machine__kernel_map(struct machine *machine, enum map_type type)struct thread *machine__find_thread (struct machine *machine,pid_t tid); -int machine__process_comm_event (struct machine *machine,union perf_event *event); -int machine__process_exit_event (struct machine *machine,union perf_event *event); -int machine__process_fork_event (struct machine *machine,union perf_event *event); -int machine__process_lost_event (struct machine *machine,union perf_event *event); -int machine__process_mmap_event (struct machine *machine,union perf_event *event); -int machine__process_mmap2_event (struct machine *machine,union perf_event *event); -int machine__process_event (struct machine *machine,union perf_event *event); +int machine__process_comm_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample); +int machine__process_exit_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample); +int machine__process_fork_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample); +int machine__process_lost_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample); +int machine__process_mmap_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample); +int machine__process_mmap2_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample); +int machine__process_event (struct machine *machine,union perf_event *event, +struct perf_sample *sample);typedef void (*machine__process_t )(struct machine *machine,void *data);
tools/perf/util/session.c +1 -1
@@ -1100,7 +1100,7 @@ static struct thread *perf_session__register_idle_thread(struct perf_session *se {struct thread *thread =perf_session__findnew (self,0 ); -if (thread ==NULL ||thread__set_comm (thread,"swapper" )) { +if (thread ==NULL ||thread__set_comm (thread,"swapper" ,0 )) {pr_err ("problem inserting idle task.\n" ); thread =NULL ; }
tools/perf/util/thread.c +4 -2
@@ -31,7 +31,8 @@ void thread__delete(struct thread *thread)free (thread); } -int thread__set_comm (struct thread *thread,const char *comm) +int thread__set_comm (struct thread *thread,const char *comm, +u64 timestamp__maybe_unused ) {int err;
@@ -73,7 +74,8 @@ void thread__insert_map(struct thread *thread, struct map *map)map_groups__insert (&thread->mg, map); } -int thread__fork (struct thread *thread,struct thread *parent) +int thread__fork (struct thread *thread,struct thread *parent, +u64 timestamp__maybe_unused ) {int i;
tools/perf/util/thread.h +2 -2
@@ -33,11 +33,11 @@ static inline void thread__exited(struct thread *thread) thread->dead = true; } -int thread__set_comm (struct thread *self,const char *comm); +int thread__set_comm (struct thread *thread,const char *comm,u64 timestamp);int thread__comm_len (struct thread *self);const char *thread__comm_str (const struct thread *thread);void thread__insert_map (struct thread *self,struct map *map); -int thread__fork (struct thread *self,struct thread *parent); +int thread__fork (struct thread *thread,struct thread *parent,u64 timestamp);size_t thread__fprintf (struct thread *thread,FILE *fp); static inline struct map *thread__find_map(struct thread *self,
Signature · 1 line
1.8.1.4
PATCH 5/29 perf tools: Add new COMM infrastructure
In reply to Arnaldo Carvalho de MeloFrom: Frederic Weisbecker <[email protected]>
This new COMM infrastructure provides two features:
1) It keeps track of all comms lifecycle for a given thread. This way we can associate a timeframe to any thread COMM, as long as PERF_SAMPLE_TIME samples are joined to COMM and fork events.
As a result we should have more precise COMM sorted hists with seperated entries for pre and post exec time after a fork.
2) It also makes sure that a given COMM string is not duplicated but rather shared among the threads that refer to it. This way the threads COMM can be compared against pointer values from the sort infrastructure.
--- tools/perf/Makefile.perf | 2 + tools/perf/builtin-trace.c | 4 +- tools/perf/util/comm.c | 106 +++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/comm.h | 20 +++++++++ tools/perf/util/thread.c | 92 +++++++++++++++++++++++++++++---------- tools/perf/util/thread.h | 3 +- 6 files changed, 200 insertions(+), 27 deletions(-) create mode 100644 tools/perf/util/comm.c create mode 100644 tools/perf/util/comm.h
tools/perf/Makefile.perf +2 -0
@@ -273,6 +273,7 @@ LIB_H += util/color.h LIB_H += util/values.h LIB_H += util/sort.h LIB_H += util/hist.h +LIB_H += util/comm.h LIB_H += util/thread.h LIB_H += util/thread_map.h LIB_H += util/trace-event.h
@@ -341,6 +342,7 @@ LIB_OBJS += $(OUTPUT)util/machine.o LIB_OBJS += $(OUTPUT)util/map.o LIB_OBJS += $(OUTPUT)util/pstack.o LIB_OBJS += $(OUTPUT)util/session.o +LIB_OBJS += $(OUTPUT)util/comm.o LIB_OBJS += $(OUTPUT)util/thread.o LIB_OBJS += $(OUTPUT)util/thread_map.o LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
tools/perf/builtin-trace.c +2 -2
@@ -1114,7 +1114,7 @@ static size_t trace__fprintf_entry_head(struct trace *trace, struct thread *threif (trace->multiple_threads) {if (trace->show_comm) - printed +=fprintf (fp,"%.14s/" , thread->comm); + printed +=fprintf (fp,"%.14s/" ,thread__comm_str (thread)); printed +=fprintf (fp,"%d " , thread->tid); }
@@ -1986,7 +1986,7 @@ static int trace__fprintf_one_thread(struct thread *thread, void *priv)else if (ratio >5.0 ) color =PERF_COLOR_YELLOW ; - printed +=color_fprintf (fp, color,"%20s" , thread->comm); + printed +=color_fprintf (fp, color,"%20s" ,thread__comm_str (thread)); printed +=fprintf (fp," - %-5d :%11lu [" , thread->tid, ttrace->nr_events); printed +=color_fprintf (fp, color,"%5.1f%%" , ratio); printed +=fprintf (fp," ] %10.3f ms\n" , ttrace->runtime_ms);
tools/perf/util/comm.c new file +106 -0
106 lines not on this page · raw message
tools/perf/util/comm.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef __PERF_COMM_H +#define __PERF_COMM_H + +#include "../perf.h" +#include <linux/rbtree.h> +#include <linux/list.h> + +struct comm_str ; + +struct comm { +struct comm_str *comm_str; +u64 start; +struct list_head list; +}; + +void comm__free (struct comm *comm); +struct comm *comm__new (const char *str,u64 timestamp); +const char *comm__str (const struct comm *comm); + +#endif /* __PERF_COMM_H */
tools/perf/util/thread.c +68 -24
141 lines not on this page · raw message
tools/perf/util/thread.h +2 -1
@@ -2,6 +2,7 @@#define __PERF_THREAD_H#include <linux/rbtree.h> +#include <linux/list.h> #include <unistd.h> #include <sys/types.h> #include "symbol.h"
@@ -18,7 +19,7 @@ struct thread {char shortname[3 ];bool comm_set;bool dead;/* if set thread has exited */ -char *comm; +struct list_head comm_list;int comm_len;void *priv;
Signature · 1 line
1.8.1.4
PATCH 6/29 perf tools: Compare hists comm by addresses
In reply to Arnaldo Carvalho de MeloFrom: Frederic Weisbecker <[email protected]>
Now that comm strings are allocated only once and refcounted to be shared among threads, these can now be safely compared by addresses. This should remove most hists collapses on post processing.
--- tools/perf/util/sort.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/sort.c +2 -1
@@ -80,7 +80,8 @@ struct sort_entry sort_thread = {static int64_t sort__comm_cmp (struct hist_entry *left,struct hist_entry *right) { -return right->thread->tid - left->thread->tid; +/* Compare the addr that should be unique among comm */ +return thread__comm_str (right->thread) -thread__comm_str (left->thread); } static int64_t
Signature · 1 line
1.8.1.4
PATCH 7/29 perf tools: Get current comm instead of last one
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
At insert time, a hist entry should reference comm at the time otherwise it'll get the last comm anyway.
--- tools/perf/util/comm.c | 15 +++++++++++++++ tools/perf/util/comm.h | 1 + tools/perf/util/hist.c | 3 +++ tools/perf/util/sort.c | 14 +++++--------- tools/perf/util/sort.h | 1 + tools/perf/util/thread.c | 6 +++--- tools/perf/util/thread.h | 2 ++ 7 files changed, 30 insertions(+), 12 deletions(-)
tools/perf/util/comm.c +15 -0
@@ -94,6 +94,21 @@ struct comm *comm__new(const char *str, u64 timestamp)return comm; } +void comm__override (struct comm *comm,const char *str,u64 timestamp) +{ +struct comm_str *old = comm->comm_str; + + comm->comm_str =comm_str__findnew (str, &comm_str_root); +if (!comm->comm_str) { + comm->comm_str = old; +return ; + } + + comm->start = timestamp; +comm_str__get (comm->comm_str); +comm_str__put (old); +} +void comm__free (struct comm *comm) {comm_str__put (comm->comm_str);
tools/perf/util/comm.h +1 -0
@@ -16,5 +16,6 @@ struct comm {void comm__free (struct comm *comm);struct comm *comm__new (const char *str,u64 timestamp);const char *comm__str (const struct comm *comm); +void comm__override (struct comm *comm,const char *str,u64 timestamp);#endif /* __PERF_COMM_H */
tools/perf/util/hist.c +3 -0
@@ -416,6 +416,7 @@ struct hist_entry *__hists__add_mem_entry(struct hists *hists, {struct hist_entry entry = { .thread = al->thread, + .comm =thread__comm (al->thread), .ms = { .map = al->map, .sym = al->sym,
@@ -446,6 +447,7 @@ struct hist_entry *__hists__add_branch_entry(struct hists *hists, {struct hist_entry entry = { .thread = al->thread, + .comm =thread__comm (al->thread), .ms = { .map = bi->to.map, .sym = bi->to.sym,
@@ -475,6 +477,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists, {struct hist_entry entry = { .thread = al->thread, + .comm =thread__comm (al->thread), .ms = { .map = al->map, .sym = al->sym,
tools/perf/util/sort.c +5 -9
@@ -1,5 +1,6 @@#include "sort.h" #include "hist.h" +#include "comm.h" #include "symbol.h" regex_t parent_regex;
@@ -81,25 +82,20 @@ static int64_t sort__comm_cmp(struct hist_entry *left, struct hist_entry *right) {/* Compare the addr that should be unique among comm */ -return thread__comm_str (right->thread) -thread__comm_str (left->thread); +return comm__str (right->comm) -comm__str (left->comm); }static int64_t sort__comm_collapse (struct hist_entry *left,struct hist_entry *right) { -const char *comm_l =thread__comm_str (left->thread); -const char *comm_r =thread__comm_str (right->thread); - -if (!comm_l || !comm_r) -return cmp_null (comm_l, comm_r); - -return strcmp (comm_l, comm_r); +/* Compare the addr that should be unique among comm */ +return comm__str (right->comm) -comm__str (left->comm); }static int hist_entry__comm_snprintf (struct hist_entry *he,char *bf,size_t size,unsigned int width) { -return repsep_snprintf (bf, size,"%*s" , width,thread__comm_str (he->thread)); +return repsep_snprintf (bf, size,"%*s" , width,comm__str (he->comm)); }struct sort_entry sort_comm = {
tools/perf/util/sort.h +1 -0
@@ -84,6 +84,7 @@ struct hist_entry {struct he_stat stat;struct map_symbol ms;struct thread *thread; +struct comm *comm;u64 ip;u64 transaction;s32 cpu;
tools/perf/util/thread.c +3 -3
@@ -54,7 +54,7 @@ void thread__delete(struct thread *thread)free (thread); } -static struct comm *thread__comm (const struct thread *thread) +struct comm *thread__comm (const struct thread *thread) {if (list_empty (&thread->comm_list))return NULL ;
@@ -69,8 +69,8 @@ int thread__set_comm(struct thread *thread, const char *str, u64 timestamp)/* Override latest entry if it had no specific time coverage */ if (!curr->start) { -list_del (&curr->list); -comm__free (curr); +comm__override (curr, str, timestamp); +return 0 ; } new =comm__new (str, timestamp);
tools/perf/util/thread.h +2 -0
@@ -26,6 +26,7 @@ struct thread { };struct machine ; +struct comm ;struct thread *thread__new (pid_t pid,pid_t tid);void thread__delete (struct thread *self);
@@ -36,6 +37,7 @@ static inline void thread__exited(struct thread *thread)int thread__set_comm (struct thread *thread,const char *comm,u64 timestamp);int thread__comm_len (struct thread *self); +struct comm *thread__comm (const struct thread *thread);const char *thread__comm_str (const struct thread *thread);void thread__insert_map (struct thread *self,struct map *map);int thread__fork (struct thread *thread,struct thread *parent,u64 timestamp);
Signature · 1 line
1.8.1.4
PATCH 8/29 perf evsel: Add a debug print if perf_event_open fails
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
There is a debug print (at verbose level 2) for each call to perf_event_open. Add another debug print if the call fails, and print the error number.
--- tools/perf/util/evsel.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/evsel.c +2 -0
@@ -1051,6 +1051,8 @@ retry_open: group_fd, flags);if (FD (evsel, cpu, thread) <0 ) { err = -errno; +pr_debug2 ("perf_event_open failed, error %d\n" , + err); goto try_fallback; } set_rlimit =NO_CHANGE ;
Signature · 1 line
1.8.1.4
PATCH 9/29 perf script: Set up output options for in-stream attributes
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Attributes (struct perf_event_attr) are recorded separately in the perf.data file. perf script uses them to set up output options. However attributes can also be in the event stream, for example when the input is a pipe (i.e. live mode). This patch makes perf script process in-stream attributes in the same way as on-file attributes.
Here is an example:
Before this patch:
$ perf record uname | perf script Linux [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.015 MB (null) (~655 samples) ] :4220 4220 [-01] 2933367.838906: cycles:
:4220 4220 [-01] 2933367.838910: cycles:
:4220 4220 [-01] 2933367.838912: cycles:
:4220 4220 [-01] 2933367.838914: cycles:
:4220 4220 [-01] 2933367.838916: cycles:
:4220 4220 [-01] 2933367.838918: cycles:
uname 4220 [-01] 2933367.838938: cycles:
uname 4220 [-01] 2933367.839207: cycles:
After this patch:
$ perf record uname | perf script
Linux
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.015 MB (null) (~655 samples) ]
:4582 4582 2933425.707724: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707728: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707730: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707732: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707734: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707736: cycles: ffffffff81309a24 memcpy ([kernel.kallsyms])
uname 4582 2933425.707760: cycles: ffffffff8109c1c7 enqueue_task_fair ([kernel.kallsyms])
uname 4582 2933425.707978: cycles: ffffffff81308457 clear_page_c ([kernel.kallsyms])--- tools/perf/builtin-script.c | 64 +++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 16 deletions(-)
tools/perf/builtin-script.c +48 -16
@@ -229,6 +229,24 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,return 0 ; } +static void set_print_ip_opts (struct perf_event_attr *attr) +{ +unsigned int type = attr->type; + + output[type].print_ip_opts =0 ; +if (PRINT_FIELD (IP )) + output[type].print_ip_opts |=PRINT_IP_OPT_IP ; + +if (PRINT_FIELD (SYM )) + output[type].print_ip_opts |=PRINT_IP_OPT_SYM ; + +if (PRINT_FIELD (DSO )) + output[type].print_ip_opts |=PRINT_IP_OPT_DSO ; + +if (PRINT_FIELD (SYMOFFSET )) + output[type].print_ip_opts |=PRINT_IP_OPT_SYMOFFSET ; +} +/* * verify all user requested events exist and the samples * have the expected data
@@ -237,7 +255,6 @@ static int perf_session__check_output_opt(struct perf_session *session) {int j;struct perf_evsel *evsel; -struct perf_event_attr *attr;for (j =0 ; j <PERF_TYPE_MAX ; ++j) { evsel =perf_session__find_first_evtype (session, j);
@@ -260,20 +277,7 @@ static int perf_session__check_output_opt(struct perf_session *session)if (evsel ==NULL )continue ; - attr = &evsel->attr; - - output[j].print_ip_opts =0 ; -if (PRINT_FIELD (IP )) - output[j].print_ip_opts |=PRINT_IP_OPT_IP ; - -if (PRINT_FIELD (SYM )) - output[j].print_ip_opts |=PRINT_IP_OPT_SYM ; - -if (PRINT_FIELD (DSO )) - output[j].print_ip_opts |=PRINT_IP_OPT_DSO ; - -if (PRINT_FIELD (SYMOFFSET )) - output[j].print_ip_opts |=PRINT_IP_OPT_SYMOFFSET ; +set_print_ip_opts (&evsel->attr); }return 0 ;
@@ -547,6 +551,34 @@ struct perf_script {struct perf_session *session; }; +static int process_attr (struct perf_tool *tool,union perf_event *event, +struct perf_evlist **pevlist) +{ + struct perf_script *scr = container_of(tool, struct perf_script, tool); +struct perf_evlist *evlist; +struct perf_evsel *evsel, *pos; +int err; + + err =perf_event__process_attr (tool, event, pevlist); +if (err) +return err; + + evlist = *pevlist; + evsel =perf_evlist__last (*pevlist); + +if (evsel->attr.type >=PERF_TYPE_MAX ) +return 0 ; + +list_for_each_entry (pos, &evlist->entries, node) { +if (pos->attr.type == evsel->attr.type && pos != evsel) +return 0 ; + } + +set_print_ip_opts (&evsel->attr); + +return perf_evsel__check_attr (evsel, scr->session); +} +static void sig_handler (int sig__maybe_unused ) { session_done =1 ;
@@ -1272,7 +1304,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) .comm = perf_event__process_comm, .exit = perf_event__process_exit, .fork = perf_event__process_fork, - .attr = perf_event__process_attr, + .attr = process_attr, .tracing_data = perf_event__process_tracing_data, .build_id = perf_event__process_build_id, .ordered_samples = true,
Signature · 1 line
1.8.1.4
PATCH 10/29 perf tools: Fix 32-bit cross build
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Setting EXTRA_CFLAGS=-m32 did not work because it was not passed around.
--- tools/perf/Makefile.perf | 2 +- tools/perf/config/Makefile | 4 ++-- tools/perf/config/feature-checks/Makefile | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
tools/perf/Makefile.perf +1 -1
@@ -711,7 +711,7 @@ $(LIB_FILE): $(LIB_OBJS) TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch]) $(LIBTRACEEVENT): $(TE_SOURCES) - $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libtraceevent.a + $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) CFLAGS="-g -Wall $(EXTRA_CFLAGS)" libtraceevent.a $(LIBTRACEEVENT)-clean: $(call QUIET_CLEAN, libtraceevent)
tools/perf/config/Makefile +2 -2
@@ -96,7 +96,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))
@@ -173,7 +173,7 @@ ifeq ($(feature-all), 1) # $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat))) else - $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) + $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) endif
tools/perf/config/feature-checks/Makefile +1 -1
@@ -31,7 +31,7 @@ CC := $(CC) -MD all: $(FILES) -BUILD = $(CC) $(LDFLAGS) -o $(OUTPUT)$@ [email protected] +BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ [email protected] ###############################
Signature · 1 line
1.8.1.4
PATCH 11/29 perf tools: Fix libunwind build and feature detection for 32-bit build
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Use -lunwind-x86 instead of -lunwind-x86_64 for 32-bit build.
--- tools/perf/config/Makefile | 6 ++++-- tools/perf/config/feature-checks/Makefile | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
tools/perf/config/Makefile +4 -2
@@ -25,9 +25,11 @@ ifeq ($(ARCH),x86_64) RAW_ARCH := x86_64 CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S + LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 + else + LIBUNWIND_LIBS = -lunwind -lunwind-x86 endif NO_PERF_REGS := 0 - LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 endif ifeq ($(NO_PERF_REGS),0)
@@ -96,7 +98,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))
tools/perf/config/feature-checks/Makefile +2 -2
@@ -36,7 +36,7 @@ BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ [email protected] ############################### test-all: - $(BUILD) -Werror -fstack-protector -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lunwind -lunwind-x86_64 -lelf -laudit -I/usr/include/slang -lslang $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl + $(BUILD) -Werror -fstack-protector -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -lelf -laudit -I/usr/include/slang -lslang $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl test-hello: $(BUILD)
@@ -72,7 +72,7 @@ test-libnuma: $(BUILD) -lnuma test-libunwind: - $(BUILD) -lunwind -lunwind-x86_64 -lelf + $(BUILD) $(LIBUNWIND_LIBS) -lelf test-libaudit: $(BUILD) -laudit
Signature · 1 line
1.8.1.4
PATCH 12/29 perf evlist: Add a debug print if event buffer mmap fails
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Add a debug print if mmap of the perf event ring buffer fails.
--- tools/perf/util/evlist.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/evlist.c +2 -0
@@ -607,6 +607,8 @@ static int __perf_evlist__mmap(struct perf_evlist *evlist, evlist->mmap[idx].base =mmap (NULL , evlist->mmap_len, prot,MAP_SHARED , fd,0 );if (evlist->mmap[idx].base ==MAP_FAILED ) { +pr_debug2 ("failed to mmap perf event ring buffer, error %d\n" , + errno); evlist->mmap[idx].base =NULL ;return -1 ; }
Signature · 1 line
1.8.1.4
PATCH 13/29 perf evsel: Always use perf_evsel__set_sample_bit()
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Always use perf_evsel__set_sample_bit() rather than just setting the bit.
--- tools/perf/util/evsel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/evsel.c +3 -3
@@ -663,7 +663,7 @@ void perf_evsel__config(struct perf_evsel *evsel, }if (opts->sample_address) - attr->sample_type |=PERF_SAMPLE_DATA_SRC ; +perf_evsel__set_sample_bit (evsel,DATA_SRC );if (opts->no_delay) { attr->watermark =0 ;
@@ -675,13 +675,13 @@ void perf_evsel__config(struct perf_evsel *evsel, }if (opts->sample_weight) - attr->sample_type |=PERF_SAMPLE_WEIGHT ; +perf_evsel__set_sample_bit (evsel,WEIGHT ); attr->mmap = track; attr->comm = track;if (opts->sample_transaction) - attr->sample_type |=PERF_SAMPLE_TRANSACTION ; +perf_evsel__set_sample_bit (evsel,TRANSACTION );/* * XXX see the function comment above
Signature · 1 line
1.8.1.4
PATCH 14/29 perf evsel: Add missing overflow check for TRANSACTION
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Add missing overflow check for PERF_SAMPLE_TRANSACTION in perf_evsel__parse_sample().
--- tools/perf/util/evsel.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/evsel.c +1 -0
@@ -1481,6 +1481,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, data->transaction =0 ;if (type &PERF_SAMPLE_TRANSACTION ) { +OVERFLOW_CHECK_u64 (array); data->transaction = *array; array++; }
Signature · 1 line
1.8.1.4
PATCH 15/29 perf test: Update "sample parsing" test for PERF_SAMPLE_TRANSACTION
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
In fact the "sample parsing" test does not automatically check new sample type bits - they must be added to the comparison logic.
Doing that shows that the test fails because the functions perf_event__synthesize_sample() and perf_event__sample_event_size() have not been updated with PERF_SAMPLE_TRANSACTION either.
--- tools/perf/tests/sample-parsing.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/tests/sample-parsing.c +6 -1
@@ -121,6 +121,9 @@ static bool samples_same(const struct perf_sample *s1,if (type &PERF_SAMPLE_DATA_SRC )COMP (data_src); +if (type &PERF_SAMPLE_TRANSACTION ) +COMP (transaction); +return true; }
@@ -165,6 +168,7 @@ static int do_test(u64 sample_type, u64 sample_regs_user, u64 read_format) .cpu = 110, .raw_size = sizeof(raw_data), .data_src = 111, + .transaction = 112, .raw_data = (void *)raw_data, .callchain = &callchain.callchain, .branch_stack = &branch_stack.branch_stack,
@@ -273,7 +277,8 @@ int test__sample_parsing(void)/* * Fail the test if it has not been updated when new sample format bits -* were added. +* were added. Please actually update the test rather than just change +* the condition below. */ if (PERF_SAMPLE_MAX >PERF_SAMPLE_TRANSACTION <<1 ) {pr_debug ("sample format has changed, some new PERF_SAMPLE_ bit was introduced - test needs updating\n" );
Signature · 1 line
1.8.1.4
PATCH 16/29 perf evsel: Synthesize PERF_SAMPLE_TRANSACTION
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Add missing PERF_SAMPLE_TRANSACTION to perf_event__synthesize_sample() and perf_event__sample_event_size().
This makes the "sample parsing" test pass.
--- tools/perf/util/evsel.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/perf/util/evsel.c +8 -0
@@ -1578,6 +1578,9 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,if (type &PERF_SAMPLE_DATA_SRC ) result +=sizeof (u64); +if (type &PERF_SAMPLE_TRANSACTION ) + result +=sizeof (u64); +return result; }
@@ -1751,6 +1754,11 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, array++; } +if (type &PERF_SAMPLE_TRANSACTION ) { + *array = sample->transaction; + array++; + } +return 0 ; }
Signature · 1 line
1.8.1.4
PATCH 17/29 perf tools: Show single option when failed to parse
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
Current option parser outputs whole option help string when it failed to parse an option. However this is not good for user if the command has many option, she might feel hard which one is related easily.
Fix it by just showing the help message of the given option only.
--- tools/perf/util/parse-options.c | 217 ++++++++++++++++++++++++---------------- tools/perf/util/parse-options.h | 4 +- 2 files changed, 132 insertions(+), 89 deletions(-)
tools/perf/util/parse-options.c +129 -88
@@ -339,10 +339,10 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,if (arg[1 ] !='-' ) { ctx->opt = arg +1 ;if (internal_help && *ctx->opt =='h' ) -return parse_options_usage (usagestr, options); +return usage_with_options_internal (usagestr, options,0 );switch (parse_short_opt (ctx, options)) {case -1 : -return parse_options_usage (usagestr, options); +return parse_options_usage (usagestr, options, arg +1 ,1 );case -2 : goto unknown;default :
@@ -352,10 +352,11 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,check_typos (arg +1 , options);while (ctx->opt) {if (internal_help && *ctx->opt =='h' ) -return parse_options_usage (usagestr, options); +return usage_with_options_internal (usagestr, options,0 ); + arg = ctx->opt;switch (parse_short_opt (ctx, options)) {case -1 : -return parse_options_usage (usagestr, options); +return parse_options_usage (usagestr, options, arg,1 );case -2 :/* fake a short option thing to hide the fact that we may have * started to parse aggregated stuff
@@ -383,12 +384,12 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,if (internal_help && !strcmp (arg +2 ,"help-all" ))return usage_with_options_internal (usagestr, options,1 );if (internal_help && !strcmp (arg +2 ,"help" )) -return parse_options_usage (usagestr, options); +return usage_with_options_internal (usagestr, options,0 );if (!strcmp (arg +2 ,"list-opts" ))return PARSE_OPT_LIST ;switch (parse_long_opt (ctx, arg +2 , options)) {case -1 : -return parse_options_usage (usagestr, options); +return parse_options_usage (usagestr, options, arg +2 ,0 );case -2 : goto unknown;default :
@@ -445,6 +446,89 @@ int parse_options(int argc, const char **argv, const struct option *options,#define USAGE_OPTS_WIDTH 24#define USAGE_GAP 2 +static void print_option_help (const struct option *opts,int full) +{ +size_t pos; +int pad; + +if (opts->type ==OPTION_GROUP ) { +fputc ('\n' , stderr); +if (*opts->help) +fprintf (stderr,"%s\n" , opts->help); +return ; + } +if (!full && (opts->flags &PARSE_OPT_HIDDEN )) +return ; + + pos =fprintf (stderr," " ); +if (opts->short_name) + pos +=fprintf (stderr,"-%c" , opts->short_name); +else + pos +=fprintf (stderr," " ); + +if (opts->long_name && opts->short_name) + pos +=fprintf (stderr,", " ); +if (opts->long_name) + pos +=fprintf (stderr,"--%s" , opts->long_name); + +switch (opts->type) { +case OPTION_ARGUMENT : +break ; +case OPTION_LONG : +case OPTION_U64 : +case OPTION_INTEGER : +case OPTION_UINTEGER : +if (opts->flags &PARSE_OPT_OPTARG ) +if (opts->long_name) + pos +=fprintf (stderr,"[=<n>]" ); +else + pos +=fprintf (stderr,"[<n>]" ); +else + pos +=fprintf (stderr," <n>" ); +break ; +case OPTION_CALLBACK : +if (opts->flags &PARSE_OPT_NOARG ) +break ; +/* FALLTHROUGH */ +case OPTION_STRING : +if (opts->argh) { +if (opts->flags &PARSE_OPT_OPTARG ) +if (opts->long_name) + pos +=fprintf (stderr,"[=<%s>]" , opts->argh); +else + pos +=fprintf (stderr,"[<%s>]" , opts->argh); +else + pos +=fprintf (stderr," <%s>" , opts->argh); + }else { +if (opts->flags &PARSE_OPT_OPTARG ) +if (opts->long_name) + pos +=fprintf (stderr,"[=...]" ); +else + pos +=fprintf (stderr,"[...]" ); +else + pos +=fprintf (stderr," ..." ); + } +break ; +default :/* OPTION_{BIT,BOOLEAN,SET_UINT,SET_PTR} */ +case OPTION_END : +case OPTION_GROUP : +case OPTION_BIT : +case OPTION_BOOLEAN : +case OPTION_INCR : +case OPTION_SET_UINT : +case OPTION_SET_PTR : +break ; + } + +if (pos <=USAGE_OPTS_WIDTH ) + pad =USAGE_OPTS_WIDTH - pos; +else { +fputc ('\n' , stderr); + pad =USAGE_OPTS_WIDTH ; + } +fprintf (stderr,"%*s%s\n" , pad +USAGE_GAP ,"" , opts->help); +} +int usage_with_options_internal (const char *const *usagestr,const struct option *opts,int full) {
@@ -464,87 +548,9 @@ int usage_with_options_internal(const char * const *usagestr,if (opts->type !=OPTION_GROUP )fputc ('\n' , stderr); -for (; opts->type !=OPTION_END ; opts++) { -size_t pos; -int pad; - -if (opts->type ==OPTION_GROUP ) { -fputc ('\n' , stderr); -if (*opts->help) -fprintf (stderr,"%s\n" , opts->help); -continue ; - } -if (!full && (opts->flags &PARSE_OPT_HIDDEN )) -continue ; - - pos =fprintf (stderr," " ); -if (opts->short_name) - pos +=fprintf (stderr,"-%c" , opts->short_name); -else - pos +=fprintf (stderr," " ); - -if (opts->long_name && opts->short_name) - pos +=fprintf (stderr,", " ); -if (opts->long_name) - pos +=fprintf (stderr,"--%s" , opts->long_name); +for ( ; opts->type !=OPTION_END ; opts++) +print_option_help (opts, full); -switch (opts->type) { -case OPTION_ARGUMENT : -break ; -case OPTION_LONG : -case OPTION_U64 : -case OPTION_INTEGER : -case OPTION_UINTEGER : -if (opts->flags &PARSE_OPT_OPTARG ) -if (opts->long_name) - pos +=fprintf (stderr,"[=<n>]" ); -else - pos +=fprintf (stderr,"[<n>]" ); -else - pos +=fprintf (stderr," <n>" ); -break ; -case OPTION_CALLBACK : -if (opts->flags &PARSE_OPT_NOARG ) -break ; -/* FALLTHROUGH */ -case OPTION_STRING : -if (opts->argh) { -if (opts->flags &PARSE_OPT_OPTARG ) -if (opts->long_name) - pos +=fprintf (stderr,"[=<%s>]" , opts->argh); -else - pos +=fprintf (stderr,"[<%s>]" , opts->argh); -else - pos +=fprintf (stderr," <%s>" , opts->argh); - }else { -if (opts->flags &PARSE_OPT_OPTARG ) -if (opts->long_name) - pos +=fprintf (stderr,"[=...]" ); -else - pos +=fprintf (stderr,"[...]" ); -else - pos +=fprintf (stderr," ..." ); - } -break ; -default :/* OPTION_{BIT,BOOLEAN,SET_UINT,SET_PTR} */ -case OPTION_END : -case OPTION_GROUP : -case OPTION_BIT : -case OPTION_BOOLEAN : -case OPTION_INCR : -case OPTION_SET_UINT : -case OPTION_SET_PTR : -break ; - } - -if (pos <=USAGE_OPTS_WIDTH ) - pad =USAGE_OPTS_WIDTH - pos; -else { -fputc ('\n' , stderr); - pad =USAGE_OPTS_WIDTH ; - } -fprintf (stderr,"%*s%s\n" , pad +USAGE_GAP ,"" , opts->help); - }fputc ('\n' , stderr);return PARSE_OPT_HELP ;
@@ -559,9 +565,44 @@ void usage_with_options(const char * const *usagestr, }int parse_options_usage (const char *const *usagestr, -const struct option *opts) +const struct option *opts, +const char *optstr,bool short_opt) { -return usage_with_options_internal (usagestr, opts,0 ); +if (!usagestr) +return PARSE_OPT_HELP ; + +fprintf (stderr,"\n usage: %s\n" , *usagestr++); +while (*usagestr && **usagestr) +fprintf (stderr," or: %s\n" , *usagestr++); +while (*usagestr) { +fprintf (stderr,"%s%s\n" , + **usagestr ?" " :"" , + *usagestr); + usagestr++; + } +fputc ('\n' , stderr); + +for ( ; opts->type !=OPTION_END ; opts++) { +if (short_opt) { +if (opts->short_name == *optstr) +break ; +continue ; + } + +if (opts->long_name ==NULL ) +continue ; + +if (!prefixcmp (optstr, opts->long_name)) +break ; +if (!prefixcmp (optstr,"no-" ) && + !prefixcmp (optstr +3 , opts->long_name)) +break ; + } + +if (opts->type !=OPTION_END ) +print_option_help (opts,0 ); + +return PARSE_OPT_HELP ; }
tools/perf/util/parse-options.h +3 -1
@@ -158,7 +158,9 @@ struct parse_opt_ctx_t { };extern int parse_options_usage (const char *const *usagestr, -const struct option *opts); +const struct option *opts, +const char *optstr, +bool short_opt);extern void parse_options_start (struct parse_opt_ctx_t *ctx,int argc,const char **argv,int flags);
Signature · 1 line
1.8.1.4
PATCH 18/29 perf report: Postpone setting up browser after parsing options
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
If setup_browser() called earlier than option parsing, the actual error message can be discarded during the terminal reset. So move it after setup_sorting() checks whether the sort keys are valid.
--- tools/perf/builtin-report.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
tools/perf/builtin-report.c +12 -12
@@ -905,13 +905,6 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) input_name ="perf.data" ; } -if (strcmp (input_name,"-" ) !=0 ) -setup_browser (true); -else { - use_browser =0 ; -perf_hpp__init (); - } - file.path = input_name; file.force = report.force;
@@ -957,6 +950,18 @@ repeat:if (setup_sorting () <0 )usage_with_options (report_usage, options); +if (parent_pattern != default_parent_pattern) { +if (sort_dimension__add ("parent" ) <0 ) + goto error; + } + +if (strcmp (input_name,"-" ) !=0 ) +setup_browser (true); +else { + use_browser =0 ; +perf_hpp__init (); + } +/* * Only in the TUI browser we are doing integrated annotation, * so don't allocate extra space that won't be used in the stdio
@@ -986,11 +991,6 @@ repeat:if (symbol__init () <0 ) goto error; -if (parent_pattern != default_parent_pattern) { -if (sort_dimension__add ("parent" ) <0 ) - goto error; - } -if (argc) {/* * Special case: if there's an argument left then assume that
Signature · 1 line
1.8.1.4
PATCH 19/29 perf report: Use parse_options_usage() for -s option failure
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
The -s (--sort) option was processed after normal option parsing so that it cannot call the parse_options_usage() automatically. Currently it calls usage_with_options() which shows entire help messages for event option. Fix it by showing just -s options.
$ perf report -s help
Error: Unknown --sort key: `help'usage: perf report [<options>]
-s, --sort <key[,key2...]>
sort by key(s): pid, comm, dso, symbol, ...
--- tools/perf/builtin-report.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/builtin-report.c +4 -2
@@ -947,8 +947,10 @@ repeat: sort_order ="local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked" ; } -if (setup_sorting () <0 ) -usage_with_options (report_usage, options); +if (setup_sorting () <0 ) { +parse_options_usage (report_usage, options,"s" ,1 ); + goto error; + }if (parent_pattern != default_parent_pattern) {if (sort_dimension__add ("parent" ) <0 )
Signature · 1 line
1.8.1.4
PATCH 20/29 perf top: Use parse_options_usage() for -s option failure
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
The -s (--sort) option was processed after normal option parsing so that it cannot call the parse_options_usage() automatically. Currently it calls usage_with_options() which shows entire help messages for event option. Fix it by showing just -s options.
$ perf top -s help
Error: Unknown --sort key: `help'usage: perf top [<options>]
-s, --sort <key[,key2...]>
sort by key(s): pid, comm, dso, symbol, ...
--- tools/perf/builtin-top.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tools/perf/builtin-top.c +5 -3
@@ -1040,7 +1040,7 @@ parse_percent_limit(const struct option *opt, const char *arg,int cmd_top (int argc,const char **argv,const char *prefix__maybe_unused ) { -int status; +int status =-1 ;char errbuf[BUFSIZ ];struct perf_top top = { .count_filter =5 ,
@@ -1159,8 +1159,10 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)if (sort_order == default_sort_order) sort_order ="dso,symbol" ; -if (setup_sorting () <0 ) -usage_with_options (top_usage, options); +if (setup_sorting () <0 ) { +parse_options_usage (top_usage, options,"s" ,1 ); + goto out_delete_evlist; + }/* display thread wants entries to be collapsed in a different tree */ sort__need_collapse =1 ;
Signature · 1 line
1.8.1.4
PATCH 21/29 perf stat: Enhance option parse error message
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
Print related option help messages only when it failed to process options. While at it, modify parse_options_usage() to skip usage part so that it can be used for showing multiple option help messages naturally like below:
$ perf stat -Bx, ls -B option not supported with -x
usage: perf stat [<options>] [<command>]
-B, --big-num print large numbers with thousands' separators
-x, --field-separator <separator>
print counts with custom separator
--- tools/perf/builtin-stat.c | 42 ++++++++++++++++++++++++++--------------- tools/perf/util/parse-options.c | 3 ++- 2 files changed, 29 insertions(+), 16 deletions(-)
tools/perf/builtin-stat.c +27 -15
@@ -1596,7 +1596,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)"perf stat [<options>] [<command>]" , NULL }; -int status = -ENOMEM , run_idx; +int status = -EINVAL , run_idx;const char *mode;setlocale (LC_ALL ,"" );
@@ -1614,12 +1614,15 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)if (output_name && output_fd) {fprintf (stderr,"cannot use both --output and --log-fd\n" ); -usage_with_options (stat_usage, options); +parse_options_usage (stat_usage, options,"o" ,1 ); +parse_options_usage (NULL , options,"log-fd" ,0 ); + goto out; }if (output_fd <0 ) {fprintf (stderr,"argument to --log-fd must be a > 0\n" ); -usage_with_options (stat_usage, options); +parse_options_usage (stat_usage, options,"log-fd" ,0 ); + goto out; }if (!output) {
@@ -1656,7 +1659,9 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)/* User explicitly passed -B? */ if (big_num_opt ==1 ) {fprintf (stderr,"-B option not supported with -x\n" ); -usage_with_options (stat_usage, options); +parse_options_usage (stat_usage, options,"B" ,1 ); +parse_options_usage (NULL , options,"x" ,1 ); + goto out; }else /* Nope, so disable big number formatting */ big_num = false; }else if (big_num_opt ==0 )/* User passed --no-big-num */
@@ -1666,7 +1671,9 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)usage_with_options (stat_usage, options);if (run_count <0 ) { -usage_with_options (stat_usage, options); +pr_err ("Run count must be a positive number\n" ); +parse_options_usage (stat_usage, options,"r" ,1 ); + goto out; }else if (run_count ==0 ) { forever = true; run_count =1 ;
@@ -1678,8 +1685,10 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)fprintf (stderr,"both cgroup and no-aggregation " "modes only available in system-wide mode\n" ); -usage_with_options (stat_usage, options); -return -1 ; +parse_options_usage (stat_usage, options,"G" ,1 ); +parse_options_usage (NULL , options,"A" ,1 ); +parse_options_usage (NULL , options,"a" ,1 ); + goto out; }if (add_default_attributes ())
@@ -1688,25 +1697,28 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)perf_target__validate (&target);if (perf_evlist__create_maps (evsel_list, &target) <0 ) { -if (perf_target__has_task (&target)) +if (perf_target__has_task (&target)) {pr_err ("Problems finding threads of monitor\n" ); -if (perf_target__has_cpu (&target)) +parse_options_usage (stat_usage, options,"p" ,1 ); +parse_options_usage (NULL , options,"t" ,1 ); + }else if (perf_target__has_cpu (&target)) {perror ("failed to parse CPUs map" ); - -usage_with_options (stat_usage, options); -return -1 ; +parse_options_usage (stat_usage, options,"C" ,1 ); +parse_options_usage (NULL , options,"a" ,1 ); + } + goto out; }if (interval && interval <100 ) {pr_err ("print interval must be >= 100ms\n" ); -usage_with_options (stat_usage, options); -return -1 ; +parse_options_usage (stat_usage, options,"I" ,1 ); + goto out_free_maps; }if (perf_evlist__alloc_stats (evsel_list, interval)) goto out_free_maps;if (perf_stat_init_aggr_mode ()) - goto out; + goto out_free_maps;/* * We dont want to block the signals - that would cause
tools/perf/util/parse-options.c +2 -1
@@ -569,7 +569,7 @@ int parse_options_usage(const char * const *usagestr, const char *optstr, bool short_opt) { if (!usagestr) - return PARSE_OPT_HELP; + goto opt;fprintf (stderr,"\n usage: %s\n" , *usagestr++);while (*usagestr && **usagestr)
@@ -582,6 +582,7 @@ int parse_options_usage(const char * const *usagestr, }fputc ('\n' , stderr); +opt:for ( ; opts->type !=OPTION_END ; opts++) {if (short_opt) {if (opts->short_name == *optstr)
Signature · 1 line
1.8.1.4
PATCH 22/29 tools lib traceevent: Add support for extracting trace_clock in report
In reply to Arnaldo Carvalho de MeloFrom: Yoshihiro YUNOMAE <[email protected]>
If trace-cmd extracts trace_clock, trace-cmd reads trace_clock data from the trace.dat and switches outputting format of timestamp for each trace_clock.
--- tools/lib/traceevent/event-parse.c | 50 +++++++++++++++++++++++++++++--------- tools/lib/traceevent/event-parse.h | 6 ++++- 2 files changed, 44 insertions(+), 12 deletions(-)
tools/lib/traceevent/event-parse.c +39 -11
@@ -305,6 +305,11 @@ int pevent_register_comm(struct pevent *pevent, const char *comm, int pid)return 0 ; } +void pevent_register_trace_clock (struct pevent *pevent,char *trace_clock) +{ + pevent->trace_clock = trace_clock; +} +struct func_map {unsigned long long addr;char *func;
@@ -4443,8 +4448,21 @@ void pevent_event_info(struct trace_seq *s, struct event_format *event,trace_seq_terminate (s); } +static bool is_timestamp_in_us (char *trace_clock,bool use_trace_clock) +{ +if (!use_trace_clock) +return true; + +if (!strcmp (trace_clock,"local" ) || !strcmp (trace_clock,"global" ) + || !strcmp (trace_clock,"uptime" ) || !strcmp (trace_clock,"perf" )) +return true; + +/* trace_clock is setting in tsc or counter mode */ +return false; +} +void pevent_print_event (struct pevent *pevent,struct trace_seq *s, -struct pevent_record *record) +struct pevent_record *record,bool use_trace_clock) {static const char *spaces =" " ;/* 20 spaces */ struct event_format *event;
@@ -4457,9 +4475,14 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s,int pid;int len;int p; +bool use_usec_format; - secs = record->ts /NSECS_PER_SEC ; - nsecs = record->ts - secs *NSECS_PER_SEC ; + use_usec_format =is_timestamp_in_us (pevent->trace_clock, + use_trace_clock); +if (use_usec_format) { + secs = record->ts /NSECS_PER_SEC ; + nsecs = record->ts - secs *NSECS_PER_SEC ; + }if (record->size <0 ) {do_warning ("ug! negative record size %d" , record->size);
@@ -4484,15 +4507,20 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s, }else trace_seq_printf (s,"%16s-%-5d [%03d]" , comm, pid, record->cpu); -if (pevent->flags &PEVENT_NSEC_OUTPUT ) { - usecs = nsecs; - p =9 ; - }else { - usecs = (nsecs +500 ) /NSECS_PER_USEC ; - p =6 ; - } +if (use_usec_format) { +if (pevent->flags &PEVENT_NSEC_OUTPUT ) { + usecs = nsecs; + p =9 ; + }else { + usecs = (nsecs +500 ) /NSECS_PER_USEC ; + p =6 ; + } -trace_seq_printf (s," %5lu.%0*lu: %s: " , secs, p, usecs, event->name); +trace_seq_printf (s," %5lu.%0*lu: %s: " , + secs, p, usecs, event->name); + }else +trace_seq_printf (s," %12llu: %s: " , + record->ts, event->name);/* Space out the event names evenly. */ len =strlen (event->name);
tools/lib/traceevent/event-parse.h +5 -1
@@ -20,6 +20,7 @@#ifndef _PARSE_EVENTS_H#define _PARSE_EVENTS_H +#include <stdbool.h> #include <stdarg.h> #include <regex.h>
@@ -450,6 +451,8 @@ struct pevent {/* cache */ struct event_format *last_event; + +char *trace_clock; };static inline void pevent_set_flag (struct pevent *pevent,int flag)
@@ -527,6 +530,7 @@ enum trace_flag_type { };int pevent_register_comm (struct pevent *pevent,const char *comm,int pid); +void pevent_register_trace_clock (struct pevent *pevent,char *trace_clock);int pevent_register_function (struct pevent *pevent,char *name,unsigned long long addr,char *mod); int pevent_register_print_string(struct pevent *pevent, char *fmt,
@@ -534,7 +538,7 @@ int pevent_register_print_string(struct pevent *pevent, char *fmt,int pevent_pid_is_registered (struct pevent *pevent,int pid);void pevent_print_event (struct pevent *pevent,struct trace_seq *s, -struct pevent_record *record); +struct pevent_record *record,bool use_trace_clock);int pevent_parse_header_page (struct pevent *pevent,char *buf,unsigned long size,int long_size);
Signature · 1 line
1.8.1.4
PATCH 23/29 tools lib traceevent: Update printk formats when entered
In reply to Arnaldo Carvalho de MeloFrom: "Steven Rostedt (Red Hat)" <[email protected]>
Instead of cropping off the '"' and '\n"' from a printk format every time it is referenced, do it when it's added. This makes it easier to reference a printk_map and should speed things up a little.
--- tools/lib/traceevent/event-parse.c | 29 ++++++++++++++--------------- tools/lib/traceevent/event-parse.h | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-)
tools/lib/traceevent/event-parse.c +14 -15
@@ -604,10 +604,11 @@ find_printk(struct pevent *pevent, unsigned long long addr)* This registers a string by the address it was stored in the kernel. * The @fmt passed in is duplicated. */ -int pevent_register_print_string (struct pevent *pevent,char *fmt, +int pevent_register_print_string (struct pevent *pevent,const char *fmt,unsigned long long addr) {struct printk_list *item =malloc (sizeof (*item)); +char *p;if (!item)return -1 ;
@@ -615,10 +616,21 @@ int pevent_register_print_string(struct pevent *pevent, char *fmt, item->next = pevent->printklist; item->addr = addr; +/* Strip off quotes and '\n' from the end */ +if (fmt[0 ] =='"' ) + fmt++; item->printk =strdup (fmt);if (!item->printk) goto out_free; + p = item->printk +strlen (item->printk) -1 ; +if (*p =='"' ) + *p =0 ; + + p -=2 ; +if (strcmp (p,"\\n" ) ==0 ) + *p =0 ; + pevent->printklist = item; pevent->printk_count++;
@@ -3887,7 +3899,6 @@ get_bprint_format(void *data, int size __maybe_unused,struct format_field *field;struct printk_map *printk;char *format; -char *p; field = pevent->bprint_fmt_field;
@@ -3909,20 +3920,8 @@ get_bprint_format(void *data, int size __maybe_unused,return format; } - p = printk->printk; -/* Remove any quotes. */ -if (*p =='"' ) - p++; -if (asprintf (&format,"%s : %s" ,"%pf" , p) <0 ) +if (asprintf (&format,"%s : %s" ,"%pf" , printk->printk) <0 )return NULL ; -/* remove ending quotes and new line since we will add one too */ - p = format +strlen (format) -1 ; -if (*p =='"' ) - *p =0 ; - - p -=2 ; -if (strcmp (p,"\\n" ) ==0 ) - *p =0 ;return format; }
tools/lib/traceevent/event-parse.h +1 -1
@@ -533,7 +533,7 @@ int pevent_register_comm(struct pevent *pevent, const char *comm, int pid);void pevent_register_trace_clock (struct pevent *pevent,char *trace_clock);int pevent_register_function (struct pevent *pevent,char *name,unsigned long long addr,char *mod); -int pevent_register_print_string (struct pevent *pevent,char *fmt, +int pevent_register_print_string (struct pevent *pevent,const char *fmt,unsigned long long addr);int pevent_pid_is_registered (struct pevent *pevent,int pid);
Signature · 1 line
1.8.1.4
PATCH 24/29 tools lib traceevent: If %s is a pointer, check printk formats
In reply to Arnaldo Carvalho de MeloFrom: "Steven Rostedt (Red Hat)" <[email protected]>
If the format string of TP_printk() contains a %s, and the argument is not a string, check if the argument is a pointer that might match the printk_formats that were stored.
--- tools/lib/traceevent/event-parse.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/lib/traceevent/event-parse.c +7 -1
@@ -3505,6 +3505,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,struct pevent *pevent = event->pevent;struct print_flag_sym *flag;struct format_field *field; +struct printk_map *printk;unsigned long long val, fval;unsigned long addr;char *str;
@@ -3540,7 +3541,12 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,if (!(field->flags &FIELD_IS_ARRAY ) && field->size == pevent->long_size) { addr = *(unsigned long *)(data + field->offset); -trace_seq_printf (s,"%lx" , addr); +/* Check if it matches a print format */ + printk =find_printk (pevent, addr); +if (printk) +trace_seq_puts (s, printk->printk); +else +trace_seq_printf (s,"%lx" , addr);break ; } str =malloc (len +1 );
Signature · 1 line
1.8.1.4
PATCH 25/29 tools lib traceevent: Handle __print_hex(__get_dynamic_array(fieldname), len)
In reply to Arnaldo Carvalho de MeloFrom: Howard Cochran <[email protected]>
The kernel has a few events with a format similar to this excerpt:
field:unsigned int len; offset:12; size:4; signed:0;
field:__data_loc unsigned char[] data_array; offset:16; size:4; signed:0;print fmt: "%s", __print_hex(__get_dynamic_array(data_array), REC->len)
trace-cmd could already parse that arg correctly, but print_str_arg() was unable to handle the first parameter being a dynamic array. (It just printed a "field not found" warning).
Teach print_str_arg's PRINT_HEX case to handle the nested PRINT_DYNAMIC_ARRAY correctly. The output now matches the kernel's own formatting for this case.
--- tools/lib/traceevent/event-parse.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
tools/lib/traceevent/event-parse.c +16 -8
@@ -3588,15 +3588,23 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, }break ;case PRINT_HEX : - field = arg->hex.field->field.field; -if (!field) { - str = arg->hex.field->field.name; - field =pevent_find_any_field (event, str); -if (!field) - goto out_warning_field; - arg->hex.field->field.field = field; +if (arg->hex.field->type ==PRINT_DYNAMIC_ARRAY ) { +unsigned long offset; + offset =pevent_read_number (pevent, + data + arg->hex.field->dynarray.field->offset, + arg->hex.field->dynarray.field->size); + hex = data + (offset &0xffff ); + }else { + field = arg->hex.field->field.field; +if (!field) { + str = arg->hex.field->field.name; + field =pevent_find_any_field (event, str); +if (!field) + goto out_warning_field; + arg->hex.field->field.field = field; + } + hex = data + field->offset; } - hex = data + field->offset; len =eval_num_arg (data, size, event, arg->hex.size);for (i =0 ; i < len; i++) {if (i)
Signature · 1 line
1.8.1.4
PATCH 26/29 tools lib traceevent: Have bprintk output the same as the kernel does
In reply to Arnaldo Carvalho de MeloFrom: "Steven Rostedt (Red Hat)" <[email protected]>
The trace_bprintk() in the kernel looks like:
ring_buffer_producer_thread: Missed: 0
ring_buffer_producer_thread: Hit: 62174350
ring_buffer_producer_thread: Entries per millisec: 6296 ring_buffer_producer_thread: 158 ns per entry ring_buffer_producer_thread: Sleeping for 10 secs ring_buffer_producer_thread: Starting ring buffer hammer ring_buffer_producer_thread: End ring buffer hammer
But the current output looks like this:
ring_buffer_producer_thread : Time: 9407018 (usecs)
ring_buffer_producer_thread : Overruns: 43285485
ring_buffer_producer_thread : Read: 4405365 (by events) ring_buffer_producer_thread : Entries: 0 ring_buffer_producer_thread : Total: 47690850 ring_buffer_producer_thread : Missed: 0 ring_buffer_producer_thread : Hit: 47690850
Remove the space between the function and the colon.
--- tools/lib/traceevent/event-parse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/lib/traceevent/event-parse.c +4 -4
@@ -3802,8 +3802,8 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, strucif (asprintf (&arg->atom.atom,"%lld" , ip) <0 ) goto out_free; -/* skip the first "%pf : " */ -for (ptr = fmt +6 , bptr = data + field->offset; +/* skip the first "%pf: " */ +for (ptr = fmt +5 , bptr = data + field->offset; bptr < data + size && *ptr; ptr++) {int ls =0 ;
@@ -3929,12 +3929,12 @@ get_bprint_format(void *data, int size __maybe_unused, printk =find_printk (pevent, addr);if (!printk) { -if (asprintf (&format,"%%pf : (NO FORMAT FOUND at %llx)\n" , addr) <0 ) +if (asprintf (&format,"%%pf: (NO FORMAT FOUND at %llx)\n" , addr) <0 )return NULL ;return format; } -if (asprintf (&format,"%s : %s" ,"%pf" , printk->printk) <0 ) +if (asprintf (&format,"%s: %s" ,"%pf" , printk->printk) <0 )return NULL ;return format;
Signature · 1 line
1.8.1.4
PATCH 27/29 tools lib traceevent: Check for spaces in character array
In reply to Arnaldo Carvalho de MeloFrom: "Steven Rostedt (Red Hat)" <[email protected]>
Currently when using the raw format for fields, when looking at a character array, to determine if it is a string or not, we make sure all characters are "isprint()". If not, then we consider it a numeric array, and print the hex numbers of the characters instead.
But it seems that '\n' fails the isprint() check! Add isspace() to the check as well, such that if all characters pass isprint() or isspace() it will assume the character array is a string.
--- tools/lib/traceevent/event-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/traceevent/event-parse.c +1 -1
@@ -3981,7 +3981,7 @@ static int is_printable_array(char *p, unsigned int len)unsigned int i;for (i =0 ; i < len && p[i]; i++) -if (!isprint (p[i])) +if (!isprint (p[i]) && !isspace (p[i]))return 0 ;return 1 ; }
Signature · 1 line
1.8.1.4
PATCH 28/29 tools lib traceevent: Add flags NOHANDLE and PRINTRAW to individual events
In reply to Arnaldo Carvalho de MeloFrom: Steven Rostedt <[email protected]>
Add the flags EVENT_FL_NOHANDLE and EVENT_FL_PRINTRAW to the event flags to have the event either ignore the register handler or to ignore the handler and also print the raw format respectively.
This allows a tool to force a raw format or non handle for an event.
--- tools/lib/traceevent/event-parse.c | 4 ++-- tools/lib/traceevent/event-parse.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)
tools/lib/traceevent/event-parse.c +2 -2
@@ -4446,11 +4446,11 @@ void pevent_event_info(struct trace_seq *s, struct event_format *event, {int print_pretty =1 ; -if (event->pevent->print_raw) +if (event->pevent->print_raw || (event->flags &EVENT_FL_PRINTRAW ))print_event_fields (s, record->data, record->size, event);else { -if (event->handler) +if (event->handler && !(event->flags &EVENT_FL_NOHANDLE )) print_pretty = event->handler (s, record, event, event->context);
tools/lib/traceevent/event-parse.h +2 -0
@@ -308,6 +308,8 @@ enum {EVENT_FL_ISBPRINT =0x04 ,EVENT_FL_ISFUNCENT =0x10 ,EVENT_FL_ISFUNCRET =0x20 , +EVENT_FL_NOHANDLE =0x40 , +EVENT_FL_PRINTRAW =0x80 , EVENT_FL_FAILED = 0x80000000 };
Signature · 1 line
1.8.1.4
PATCH 29/29 tools lib traceevent: Add pevent_print_func_field() helper function
In reply to Arnaldo Carvalho de MeloFrom: Steven Rostedt <[email protected]>
Add the pevent_print_func_field() that will look up a field that is expected to be a function pointer, and it will print the function name and offset of the address given by the field.
--- tools/lib/traceevent/event-parse.c | 42 ++++++++++++++++++++++++++++++++++++++ tools/lib/traceevent/event-parse.h | 4 ++++ 2 files changed, 46 insertions(+)
tools/lib/traceevent/event-parse.c +42 -0
@@ -5367,6 +5367,48 @@ int pevent_print_num_field(struct trace_seq *s, const char *fmt,return -1 ; } +/** +* pevent_print_func_field - print a field and a format for function pointers +* @s: The seq to print to +* @fmt: The printf format to print the field with. +* @event: the event that the field is for +* @name: The name of the field +* @record: The record with the field name. +* @err: print default error if failed. +* +* Returns: 0 on success, -1 field not found, or 1 if buffer is full. +*/ +int pevent_print_func_field (struct trace_seq *s,const char *fmt, +struct event_format *event,const char *name, +struct pevent_record *record,int err) +{ +struct format_field *field =pevent_find_field (event, name); +struct pevent *pevent = event->pevent; +unsigned long long val; +struct func_map *func; +char tmp[128 ]; + +if (!field) + goto failed; + +if (pevent_read_number_field (field, record->data, &val)) + goto failed; + + func =find_func (pevent, val); + +if (func) +snprintf (tmp,128 ,"%s/0x%llx" , func->func, func->addr - val); +else +sprintf (tmp,"0x%08llx" , val); + +return trace_seq_printf (s, fmt, tmp); + + failed: +if (err) +trace_seq_printf (s,"CAN'T FIND FIELD \"%s\"" , name); +return -1 ; +} +static void free_func_handle (struct pevent_function_handler *func) {struct pevent_func_params *params;
tools/lib/traceevent/event-parse.h +4 -0
@@ -569,6 +569,10 @@ int pevent_print_num_field(struct trace_seq *s, const char *fmt, struct event_format *event, const char *name, struct pevent_record *record, int err); +int pevent_print_func_field (struct trace_seq *s,const char *fmt, +struct event_format *event,const char *name, +struct pevent_record *record,int err); +int pevent_register_event_handler (struct pevent *pevent,int id,const char *sys_name,const char *event_name,pevent_event_handler_func func,void *context);
Signature · 1 line
1.8.1.4
Quoted 8 lines · Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <[email protected]>
Hi Ingo,
Please consider pulling,
- Arnaldo
Quoted 7 lines
The following changes since commit
46d525eae2a076adfde92dca1db12d9a3b8ad8bb:perf test: Update command line callchain attribute tests (2013-11-01 10:42:57 -0300)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linuxtags/perf-urgent-for-mingo
I guess this wanted to be perf-core-for-mingo?
Pulled those bits, thanks Arnaldo!
Ingo
hm, probably one of these commits:
8a0c4c2843d3 perf tools: Fix libunwind build and feature detection for 32-bit build 28e962b9d79f perf tools: Fix 32-bit cross build74af377bc25d perf tools: Fix non-debug build9402802a416c perf tools: Fix test_on_exit for 32-bit build
broke the suppression of the auto-detection messages on repeat invocations of 'make', if all testcases pass.
'make' used to display this on repeat invocations:
comet:~/tip/tools/perf> make
BUILD: Doing 'make -j12' parallel build
comet:~/tip/tools/perf> make
BUILD: Doing 'make -j12' parallel build
comet:~/tip/tools/perf> make
BUILD: Doing 'make -j12' parallel build
Now it displays the spammy auto-detection all the time:
comet:~/tip/tools/perf> make
BUILD: Doing 'make -j12' parallel build
Auto-detecting system features:
... backtrace: [ on ] ... dwarf: [ on ] ... fortify-source: [ on ] ... glibc: [ on ] ... gtk2: [ on ] ... gtk2-infobar: [ on ] ... libaudit: [ on ] ... libbfd: [ on ] ... libelf: [ on ] ... libelf-getphdrnum: [ on ] ... libelf-mmap: [ on ] ... libnuma: [ on ] ... libperl: [ on ] ... libpython: [ on ] ... libpython-version: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... on-exit: [ on ] ... stackprotector: [ on ] ... stackprotector-all: [ on ]
maybe a new testcase fails on my box, but is not properly displayed?
Thanks,
Ingo
Quoted 27 lines · Ingo Molnar
Now it displays the spammy auto-detection all the time:
comet:~/tip/tools/perf> make
BUILD: Doing 'make -j12' parallel buildAuto-detecting system features:
... backtrace: [ on ] ... dwarf: [ on ] ... fortify-source: [ on ] ... glibc: [ on ] ... gtk2: [ on ] ... gtk2-infobar: [ on ] ... libaudit: [ on ] ... libbfd: [ on ] ... libelf: [ on ] ... libelf-getphdrnum: [ on ] ... libelf-mmap: [ on ] ... libnuma: [ on ] ... libperl: [ on ] ... libpython: [ on ] ... libpython-version: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... on-exit: [ on ] ... stackprotector: [ on ] ... stackprotector-all: [ on ]
Quoted 1 line
maybe a new testcase fails on my box, but is not properly displayed?
Hm, a 'make clean' cleaned up the condition and it now works as expected.
So what happened is that GCC got upgraded from 4.8.1 to 4.8.2 and test-all.c failed to build:
comet:~/tip/tools/perf/config/feature-checks> make -i
make: *** No rule to make target /usr/lib/gcc/x86_64-redhat-linux/4.8.1/include/limits.h', needed by test-all'. Stop.
but the individual testcases got built successfully and the perf build was fine and correct - it's just that the test-all.c .d file never got updated due to the broken dependency.
I think Namhyung warned about this during the feature-detection discussion, and I dismissed the concern - but Namhyung was right, it's a real problem.
I think to fix this we should automatically clean out potentially stale .d files automatically after testcase build failures (be it test-all.c or any other testcase)?
That would still preserve all the good roles of these dependencies and it would preserve the build speed and detection of system library changes.
Thanks,
Ingo