From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Stephane Eranian <eranian@google.com>,
Jiri Olsa <jolsa@redhat.com>, Ulrich Drepper <drepper@gmail.com>,
Andi Kleen <andi@firstfloor.org>,
Namhyung Kim <namhyung.kim@lge.com>,
Pekka Enberg <penberg@kernel.org>
Subject: [PATCH 09/12] perf ui/gtk: Add support to group viewing
Date: Tue, 24 Jul 2012 18:01:30 +0900 [thread overview]
Message-ID: <1343120493-23059-10-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1343120493-23059-1-git-send-email-namhyung@kernel.org>
From: Namhyung Kim <namhyung.kim@lge.com>
Show group members' overhead also when showing the leader's.
Cc: Stephane Eranian <eranian@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/ui/gtk/browser.c | 57 +++++++++++++++++++++++++++++++++----------
1 file changed, 44 insertions(+), 13 deletions(-)
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c
index 91e11f7bffbf..e39c83cd5ac5 100644
--- a/tools/perf/ui/gtk/browser.c
+++ b/tools/perf/ui/gtk/browser.c
@@ -44,25 +44,56 @@ static const char *perf_gtk__get_percent_color(double percent)
return NULL;
}
+static int perf_gtk__percent_color_snprintf(char *s, size_t size,
+ u64 period, u64 total_period)
+{
+ double percent = 100.0 * period / total_period;
+ const char *markup;
+ int ret = 0;
+
+ markup = perf_gtk__get_percent_color(percent);
+ if (markup)
+ ret += scnprintf(s, size, "%s", markup);
+
+ ret += scnprintf(s + ret, size - ret, "%5.2f%%", percent);
+
+ if (markup)
+ ret += scnprintf(s + ret, size - ret, "</span>");
+
+ return ret;
+}
+
+static int perf_gtk__hpp_color_overhead(struct hist_print_context *ctx,
+ struct hist_entry *he)
+{
+ int ret;
+
+ ret = perf_gtk__percent_color_snprintf(ctx->s, ctx->size,
+ he->stat.period, ctx->total_period);
+
+ if (symbol_conf.report_group) {
+ int i;
+ struct perf_evsel *evsel = hists_2_evsel(ctx->hists);
+
+ for (i = 0; i < evsel->nr_children; i++) {
+ ret += scnprintf(ctx->s + ret, ctx->size - ret, " ");
+ ret += perf_gtk__percent_color_snprintf(ctx->s + ret,
+ ctx->size - ret,
+ he->group_stats[i].period,
+ ctx->hists->group_stats[i].total_period);
+ }
+ }
+ return ret;
+}
+
#define HPP_COLOR_FN(_name, _field) \
static int perf_gtk__hpp_color_ ## _name(struct hist_print_context *ctx, \
struct hist_entry *he) \
{ \
- double percent = 100.0 * he->stat._field / ctx->total_period; \
- const char *markup; \
- int ret = 0; \
- \
- markup = perf_gtk__get_percent_color(percent); \
- if (markup) \
- ret += scnprintf(ctx->s, ctx->size, "%s", markup); \
- ret += scnprintf(ctx->s + ret, ctx->size - ret, "%5.2f%%", percent); \
- if (markup) \
- ret += scnprintf(ctx->s + ret, ctx->size - ret, "</span>"); \
- \
- return ret; \
+ return perf_gtk__percent_color_snprintf(ctx->s, ctx->size, \
+ he->stat._field, ctx->total_period); \
}
-HPP_COLOR_FN(overhead, period)
HPP_COLOR_FN(overhead_sys, period_sys)
HPP_COLOR_FN(overhead_us, period_us)
HPP_COLOR_FN(overhead_guest_sys, period_guest_sys)
--
1.7.10.4
next prev parent reply other threads:[~2012-07-24 9:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-24 9:01 [RFC/PATCHSET 00/12] perf report: Add support to event group viewing (v1) Namhyung Kim
2012-07-24 9:01 ` [PATCH 01/12] perf tools: Add a couple of helper routines to handle groups Namhyung Kim
2012-07-24 9:01 ` [PATCH 02/12] perf hist: Convert to struct he_stat Namhyung Kim
2012-07-24 9:01 ` [PATCH 03/12] perf hist: Collapse group hist_entries to a leader Namhyung Kim
2012-07-24 9:01 ` [PATCH 04/12] perf hist: Maintain total periods of group members in the leader Namhyung Kim
2012-07-24 9:01 ` [PATCH 05/12] perf report: Make another loop for output resorting Namhyung Kim
2012-07-24 9:01 ` [PATCH 06/12] perf header: Reconstruct group relationship by parsing cmdline Namhyung Kim
2012-07-25 15:39 ` Jiri Olsa
2012-07-25 15:52 ` Namhyung Kim
2012-07-24 9:01 ` [PATCH 07/12] perf ui/hist: Add support to group viewing Namhyung Kim
2012-07-24 9:01 ` [PATCH 08/12] perf ui/browser: " Namhyung Kim
2012-07-24 9:01 ` Namhyung Kim [this message]
2012-07-24 9:01 ` [PATCH 10/12] perf report: Show leader events only when event group is enabled Namhyung Kim
2012-07-24 9:01 ` [PATCH 11/12] perf report: Show group description " Namhyung Kim
2012-07-24 9:01 ` [PATCH 12/12] perf report: Add --group option Namhyung Kim
2012-07-24 9:13 ` [RFC/PATCHSET 00/12] perf report: Add support to event group viewing (v1) Namhyung Kim
2012-07-24 21:17 ` Andi Kleen
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=1343120493-23059-10-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=andi@firstfloor.org \
--cc=drepper@gmail.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=paulus@samba.org \
--cc=penberg@kernel.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
all inboxes | Powered by JetHome®