public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Jiri Olsa <jolsa@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>, Andi Kleen <andi@firstfloor.org>,
	Stephane Eranian <eranian@google.com>,
	Wang Nan <wangnan0@huawei.com>
Subject: Re: [PATCH 2/5] perf report: Show message for percent limit on stdio
Date: Fri, 26 Feb 2016 11:15:33 -0300	[thread overview]
Message-ID: <20160226141533.GV8720@kernel.org> (raw)
In-Reply-To: <1456488800-28124-2-git-send-email-namhyung@kernel.org>

Em Fri, Feb 26, 2016 at 09:13:17PM +0900, Namhyung Kim escreveu:
> When the hierarchy mode is used, some entries might be omiited due to a
> percent limit or filter.  In this case the output hierarchy is different
> than other entries.  Add an informative message to users about this.
> 
> For example, when 4% of percent limit is applied:
> 
> Before:
>   #       Overhead  Command / Shared Object / Symbol
>   # ..............  ..........................................
>   #
>       49.09%        swapper
>          48.67%        [kernel.vmlinux]
>             34.42%        [k] intel_idle
>       11.51%        firefox
>           8.87%        libpthread-2.22.so
>              6.60%        [.] __GI___libc_recvmsg
>       10.49%        gnome-shell
>           4.74%        libc-2.22.so
>       10.08%        Xorg
>           6.11%        libc-2.22.so
>              5.27%        [.] __memcpy_sse2_unaligned
>        6.15%        perf

That is great, and while testing it another idea came to me, what about
telling how many entries are below the threshold (--percent-limit)?

Something like:

    47.60%        firefox        
       44.98%        libxul.so                   
          11.01%        [.] 0x0000000001187918
          10.84%        [.] 0x0000000001187a5c
           3.10%        [.] 0x00000000011875c9
           1.62%        [.] 0x000000000118792b
           1.47%        [.] 0x00000000011875d8
           1.39%        [.] 0x0000000001187a6f
           1.31%        [.] 0x0000000001187a4a
           1.27%        [.] 0x0000000001187906
        1.45%        perf-9205.map               
                        no entry >= 1.00%
    33.40%        swapper        
       33.35%        [kernel.vmlinux]            
          30.50%        [k] intel_idle
			25 entries < 1%
    14.86%        qemu-system-x86
        7.58%        [kvm]                       
           2.40%        [k] kvm_arch_vcpu_runnable
           1.03%        [k] kvm_vcpu_check_block
			1 entry < 1%

Another: pressing enter over these 'no entry >= M%' and 'N entries < M%'
         would show those entries, for that specific point.

One more: Make '1.00%' appear as '1%' no need for .00, it adds no
information and takes precious screen space.

Thanks! Applying this patch and looking at the others in this patchkit,

- Arnaldo
 
> Note that, gnome-shell/libc has no symbols and perf has no dso/symbols.
> With that patch the output will look like below:
> 
> After:
> 
>   #       Overhead  Command / Shared Object / Symbol
>   # ..............  ..........................................
>   #
>       49.09%        swapper
>          48.67%        [kernel.vmlinux]
>             34.42%        [k] intel_idle
>       11.51%        firefox
>           8.87%        libpthread-2.22.so
>              6.60%        [.] __GI___libc_recvmsg
>       10.49%        gnome-shell
>           4.74%        libc-2.22.so
>                           no entry >= 4.00%
>       10.08%        Xorg
>           6.11%        libc-2.22.so
>              5.27%        [.] __memcpy_sse2_unaligned
>        6.15%        perf
>                        no entry >= 4.00%
> 
> Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/ui/stdio/hist.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
> index 435eaaaf2f1d..b3bdfcb245f9 100644
> --- a/tools/perf/ui/stdio/hist.c
> +++ b/tools/perf/ui/stdio/hist.c
> @@ -628,6 +628,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
>  	bool first = true;
>  	size_t linesz;
>  	char *line = NULL;
> +	unsigned indent;
>  
>  	init_rem_hits();
>  
> @@ -704,6 +705,8 @@ print_entries:
>  		goto out;
>  	}
>  
> +	indent = hists__overhead_width(hists) + 4;
> +
>  	for (nd = rb_first(&hists->entries); nd; nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD)) {
>  		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
>  		float percent;
> @@ -720,6 +723,20 @@ print_entries:
>  		if (max_rows && ++nr_rows >= max_rows)
>  			break;
>  
> +		/*
> +		 * If all children are filtered out or percent-limited,
> +		 * display "no entry >= x.xx%" message.
> +		 */
> +		if (!h->leaf && !hist_entry__has_hierarchy_children(h, min_pcnt)) {
> +			int nr_sort = hists->hpp_list->nr_sort_keys;
> +
> +			print_hierarchy_indent(sep, nr_sort + h->depth + 1, spaces, fp);
> +			fprintf(fp, "%*sno entry >= %.2f%%\n", indent, "", min_pcnt);
> +
> +			if (max_rows && ++nr_rows >= max_rows)
> +				break;
> +		}
> +
>  		if (h->ms.map == NULL && verbose > 1) {
>  			__map_groups__fprintf_maps(h->thread->mg,
>  						   MAP__FUNCTION, fp);
> -- 
> 2.7.1

  reply	other threads:[~2016-02-26 14:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 12:13 [PATCH 1/5] perf hists: Add more helper functions for the hierarchy mode Namhyung Kim
2016-02-26 12:13 ` [PATCH 2/5] perf report: Show message for percent limit on stdio Namhyung Kim
2016-02-26 14:15   ` Arnaldo Carvalho de Melo [this message]
2016-02-27  9:41   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-03-30 14:12   ` [PATCH 2/5] " Arnaldo Carvalho de Melo
2016-03-30 16:12     ` Namhyung Kim
2016-02-26 12:13 ` [PATCH 3/5] perf hists browser: Cleanup hist_browser__update_percent_limit() Namhyung Kim
2016-02-27  9:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-26 12:13 ` [PATCH 4/5] perf hists browser: Show message for percent limit Namhyung Kim
2016-02-27  9:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-26 12:13 ` [PATCH 5/5] perf report: Show message for percent limit on gtk Namhyung Kim
2016-02-27  9:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-27  9:41 ` [tip:perf/core] perf hists: Add more helper functions for the hierarchy mode tip-bot for Namhyung Kim

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=20160226141533.GV8720@kernel.org \
    --to=acme@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=wangnan0@huawei.com \
    /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