[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161123231832.GJ15978@krava>
Date: Thu, 24 Nov 2016 00:18:32 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: kan.liang@...el.com
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
linux-kernel@...r.kernel.org, alexander.shishkin@...ux.intel.com,
tglx@...utronix.de, namhyung@...nel.org, jolsa@...nel.org,
adrian.hunter@...el.com, wangnan0@...wei.com, mark.rutland@....com,
andi@...stfloor.org
Subject: Re: [PATCH 14/14] perf script: show overhead events
On Wed, Nov 23, 2016 at 04:44:52AM -0500, kan.liang@...el.com wrote:
> From: Kan Liang <kan.liang@...el.com>
>
> Introduce a new option --show-overhead to show overhead events in perf
> script
>
> Signed-off-by: Kan Liang <kan.liang@...el.com>
> ---
> tools/perf/builtin-script.c | 36 ++++++++++++++++++++++++++++++++++++
> tools/perf/util/event.c | 37 +++++++++++++++++++++++++++++++++++++
> tools/perf/util/event.h | 1 +
> 3 files changed, 74 insertions(+)
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index e1daff3..76d9747 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -829,6 +829,7 @@ struct perf_script {
> bool show_task_events;
> bool show_mmap_events;
> bool show_switch_events;
> + bool show_overhead;
> bool allocated;
> struct cpu_map *cpus;
> struct thread_map *threads;
> @@ -1264,6 +1265,37 @@ static int process_switch_event(struct perf_tool *tool,
> return 0;
> }
>
> +static int process_overhead_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;
> +
> + if (perf_event__process_switch(tool, event, sample, machine) < 0)
> + return -1;
process_switch event? copy&paste error?
jirka
> + if (sample) {
> + evsel = perf_evlist__id2evsel(session->evlist, sample->id);
> + thread = machine__findnew_thread(machine, sample->pid, sample->tid);
> + if (thread == NULL) {
> + pr_debug("problem processing OVERHEAD event, skipping it.\n");
> + return -1;
> + }
> +
> + print_sample_start(sample, thread, evsel);
> + perf_event__fprintf(event, stdout);
> + thread__put(thread);
> + } else {
> + /* USER OVERHEAD event */
> + perf_event__fprintf(event, stdout);
> + }
> +
> + return 0;
> +}
> +
SNIP
Powered by blists - more mailing lists