Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599476

Re: [PATCH] perf report: show sort_order in title

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] perf report: show sort_order in title
Date 2017-03-13 15:50 +0100
Message-ID <tkzsm-1TD-21@gated-at.bofh.it> (permalink)
References <tktGh-6dB-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Mon, Mar 13, 2017 at 04:36:35PM +0800, changbin.du@intel.com escreveu:
> From: Changbin Du <changbin.du@intel.com>
> 
> In the report, how does the data sort is a important info for
> analyser. Moreover, perf sometimes insert or append sort fields
> automatically. Thus user may confuse how it sorts w/o reading
> perf internal. So here print the order info to repor title.
> 
> Signed-off-by: Changbin Du <changbin.du@intel.com>
> ---
>  tools/perf/ui/browsers/hists.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index fc4fb66..6c6b615 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -2194,6 +2194,25 @@ static inline bool is_report_browser(void *timer)
>  	return timer == NULL;
>  }
>  
> +static int get_sort_fields_str(struct hists *hists, char *buf, size_t size)

I'll just rename this to use the tools/perf/ style for such functions,
making it:

	static int hists__scnprintf_sort_fields(hists, buf, size)

> +{
> +	struct perf_hpp_fmt *fmt;
> +	bool first = true;
> +	int ret = 0;
> +
> +	hists__for_each_sort_list(hists, fmt) {
> +		if (first) {
> +			first = false;
> +			ret += scnprintf(buf + ret, size - ret, "%s", fmt->name);
> +		} else {
> +			ret += scnprintf(buf + ret, size - ret, ",%s", fmt->name);
> +		}
> +		if (size - ret <= 0)
> +			break;
> +	}
> +	return ret;
> +}
> +
>  static int perf_evsel_browser_title(struct hist_browser *browser,
>  				char *bf, size_t size)
>  {
> @@ -2274,6 +2293,9 @@ static int perf_evsel_browser_title(struct hist_browser *browser,
>  			printed += scnprintf(bf + printed, size - printed, " [z]");
>  	}
>  
> +	get_sort_fields_str(hists, buf, sizeof(buf));
> +	printed += scnprintf(bf + printed, size - printed, ", Sort by: %s", buf);
> +
>  	return printed;
>  }
>  
> -- 
> 2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] perf report: show sort_order in title changbin.du@intel.com - 2017-03-13 09:40 +0100
  Re: [PATCH] perf report: show sort_order in title Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-13 15:50 +0100
    Re: [PATCH] perf report: show sort_order in title Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-13 16:00 +0100
      Re: [PATCH] perf report: show sort_order in title "Du, Changbin" <changbin.du@intel.com> - 2017-03-14 03:20 +0100

csiph-web