Messages in this thread | | | Date | Sun, 17 Nov 2013 21:44:46 -0700 | From | David Ahern <> | Subject | Re: [RFC/PATCH 2/3] perf script: Print comm, fork and exit events also |
| |
On 11/17/13, 8:00 PM, Namhyung Kim wrote: > @@ -578,6 +579,106 @@ static int process_attr(struct perf_tool *tool, union perf_event *event, > return perf_evsel__check_attr(evsel, scr->session); > } > > +static int process_comm_event(struct perf_tool *tool, > + union perf_event *event, > + struct perf_sample *sample, > + struct machine *machine) > +{ > + struct thread *thread; > + struct perf_script *script = container_of(tool, struct perf_script, tool); > + struct perf_session *session = script->session; > + struct perf_evsel *evsel = perf_evlist__first(session->evlist); > + char *oldname; > + > + thread = machine__findnew_thread(machine, event->comm.pid, event->comm.tid); > + if (thread == NULL) { > + pr_debug("problem processing COMM event, skipping it.\n"); > + return -1; > + } > + > + oldname = strdup(thread__comm_str(thread)); > + if (oldname == NULL) { > + pr_debug("problem processing COMM event, skipping it.\n"); > + return -1; > + } > + > + if (perf_event__process_comm(tool, event, sample, machine) < 0) > + return -1; > + > + if (!evsel->attr.sample_id_all) { > + sample->cpu = 0; > + sample->time = 0; > + sample->tid = event->comm.tid; > + sample->pid = event->comm.pid; > + } > + print_sample_start(sample, thread, evsel); > + printf("comm: %s --> %s\n", oldname, event->comm.comm);
free(oldname)
David
| |