From: changbin.du@intel.com
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org
Cc: linux-kernel@vger.kernel.org, Changbin Du <changbin.du@intel.com>
Subject: [PATCH] perf report: show sort_order in title
Date: Mon, 13 Mar 2017 16:36:35 +0800 [thread overview]
Message-ID: <20170313083635.24525-1-changbin.du@intel.com> (raw)
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)
+{
+ 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
next reply other threads:[~2017-03-13 8:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 8:36 changbin.du [this message]
2017-03-13 14:47 ` [PATCH] perf report: show sort_order in title Arnaldo Carvalho de Melo
2017-03-13 14:57 ` Arnaldo Carvalho de Melo
2017-03-14 2:16 ` Du, Changbin
2017-03-14 13:04 ` Arnaldo Carvalho de Melo
2017-03-15 2:11 ` Du, Changbin
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=20170313083635.24525-1-changbin.du@intel.com \
--to=changbin.du@intel.com \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).