public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Ian Rogers <irogers@google.com>
Subject: Re: [PATCH 1/2] perf report: Support --header-only for pipe mode
Date: Mon, 14 Dec 2020 00:00:19 +0100	[thread overview]
Message-ID: <20201213230019.GB502638@krava> (raw)
In-Reply-To: <20201210061302.88213-1-namhyung@kernel.org>

On Thu, Dec 10, 2020 at 03:13:01PM +0900, Namhyung Kim wrote:
> The --header-only checks file header and prints the feature data.  But
> as pipe mode doesn't have it in the header it prints almost nothing.
> Change it to process first few records until it founds HEADER_FEATURE.
> 
> Before:
>   $ perf record -o- true | perf report -i- --header-only
>   # ========
>   # captured on    : Thu Dec 10 14:34:59 2020
>   # header version : 1
>   # data offset    : 0
>   # data size      : 0
>   # feat offset    : 0
>   # ========
>   #
> 
> After:
>   $ perf record -o- true | perf report -i- --header-only
>   # ========
>   # captured on    : Thu Dec 10 14:49:11 2020
>   # header version : 1
>   # data offset    : 0
>   # data size      : 0
>   # feat offset    : 0
>   # ========
>   #
>   # hostname : balhae
>   # os release : 5.7.17-1xxx
>   # perf version : 5.10.rc6.gdb0ea13cc741
>   # arch : x86_64
>   # nrcpus online : 8
>   # nrcpus avail : 8
>   # cpudesc : Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
>   # cpuid : GenuineIntel,6,142,12
>   # total memory : 16158916 kB
>   # cmdline : perf record -o- true
>   # event : name = cycles, , id = { 81, 82, 83, 84, 85, 86, 87, 88 }, size = 120, ...
>   # CPU_TOPOLOGY info available, use -I to display
>   # NUMA_TOPOLOGY info available, use -I to display
>   # pmu mappings: intel_pt = 9, intel_bts = 8, software = 1, power = 20, uprobe = 7, ...
>   # time of first sample : 0.000000
>   # time of last sample : 0.000000
>   # sample duration :      0.000 ms
>   # MEM_TOPOLOGY info available, use -I to display
>   # cpu pmu capabilities: branches=32, max_precise=3, pmu_name=skylake
> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Acked-by: Jiri Olsa <jolsa@redhat.com>

thanks,
jirka

> ---
>  tools/perf/builtin-report.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 5efbd0602f17..2a845d6cac09 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -226,6 +226,8 @@ static int process_feature_event(struct perf_session *session,
>  		pr_err("failed: wrong feature ID: %" PRI_lu64 "\n",
>  		       event->feat.feat_id);
>  		return -1;
> +	} else if (rep->header_only) {
> +		session_done = 1;
>  	}
>  
>  	/*
> @@ -1512,6 +1514,13 @@ int cmd_report(int argc, const char **argv)
>  		perf_session__fprintf_info(session, stdout,
>  					   report.show_full_info);
>  		if (report.header_only) {
> +			if (data.is_pipe) {
> +				/*
> +				 * we need to process first few records
> +				 * which contains PERF_RECORD_HEADER_FEATURE.
> +				 */
> +				perf_session__process_events(session);
> +			}
>  			ret = 0;
>  			goto error;
>  		}
> -- 
> 2.29.2.576.ga3fc446d84-goog
> 


  parent reply	other threads:[~2020-12-13 23:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10  6:13 [PATCH 1/2] perf report: Support --header-only for pipe mode Namhyung Kim
2020-12-10  6:13 ` [PATCH 2/2] perf evlist: Support pipe mode display Namhyung Kim
2020-12-13 23:00   ` Jiri Olsa
2020-12-14 13:22     ` Arnaldo Carvalho de Melo
2020-12-13 23:00 ` Jiri Olsa [this message]
2020-12-14 13:22   ` [PATCH 1/2] perf report: Support --header-only for pipe mode Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201213230019.GB502638@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox