From: tip-bot for Jiri Olsa <jolsa@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
hpa@zytor.com, mingo@kernel.org, a.p.zijlstra@chello.nl,
namhyung@kernel.org, jolsa@redhat.com, fweisbec@gmail.com,
tglx@linutronix.de, cjashfor@linux.vnet.ibm.com, mingo@elte.hu
Subject: [tip:perf/core] perf hists browser: Add support to display whole group data for raw columns
Date: Wed, 6 Feb 2013 14:10:31 -0800 [thread overview]
Message-ID: <tip-0c5268bf2218144469dde3228f14898fadbbcdcd@git.kernel.org> (raw)
In-Reply-To: <1359981185-16819-2-git-send-email-jolsa@redhat.com>
Commit-ID: 0c5268bf2218144469dde3228f14898fadbbcdcd
Gitweb: http://git.kernel.org/tip/0c5268bf2218144469dde3228f14898fadbbcdcd
Author: Jiri Olsa <jolsa@redhat.com>
AuthorDate: Mon, 4 Feb 2013 13:32:55 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 6 Feb 2013 18:09:27 -0300
perf hists browser: Add support to display whole group data for raw columns
Currently we don't display group members' values for raw columns like
'Samples' and 'Period' when in group report mode.
Uniting '__hpp__percent_fmt' and '__hpp__raw_fmt' function under new
function __hpp__fmt. It's basically '__hpp__percent_fmt' code with new
'fmt_percent' bool parameter added saying whether raw number or
percentage should be printed.
This way raw columns print out all the group members when
in group report mode, like:
$ perf record -e '{cycles,cache-misses}' ls
...
$ perf report --group --show-total-period --stdio
...
# Overhead Period Command Shared Object Symbol
# ................ ........................ ....... ................. .................................
#
23.63% 11.24% 3331335 317 ls [kernel.kallsyms] [k] __lock_acquire
12.72% 0.00% 1793100 0 ls [kernel.kallsyms] [k] native_sched_clock
9.72% 0.00% 1369920 0 ls libc-2.14.90.so [.] _nl_find_locale
0.03% 0.07% 4476 2 ls [kernel.kallsyms] [k] intel_pmu_enable_all
0.00% 11.73% 0 331 ls ld-2.14.90.so [.] _dl_cache_libcmp
0.00% 11.06% 0 312 ls [kernel.kallsyms] [k] vma_interval_tree_insert
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1359981185-16819-2-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/hist.c | 53 ++++++++++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 27 deletions(-)
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index a47ce98..d671e63 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -9,18 +9,24 @@
typedef int (*hpp_snprint_fn)(char *buf, size_t size, const char *fmt, ...);
-static int __hpp__percent_fmt(struct perf_hpp *hpp, struct hist_entry *he,
- u64 (*get_field)(struct hist_entry *),
- const char *fmt, hpp_snprint_fn print_fn)
+static int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
+ u64 (*get_field)(struct hist_entry *),
+ const char *fmt, hpp_snprint_fn print_fn,
+ bool fmt_percent)
{
int ret;
- double percent = 0.0;
struct hists *hists = he->hists;
- if (hists->stats.total_period)
- percent = 100.0 * get_field(he) / hists->stats.total_period;
+ if (fmt_percent) {
+ double percent = 0.0;
+
+ if (hists->stats.total_period)
+ percent = 100.0 * get_field(he) /
+ hists->stats.total_period;
- ret = print_fn(hpp->buf, hpp->size, fmt, percent);
+ ret = print_fn(hpp->buf, hpp->size, fmt, percent);
+ } else
+ ret = print_fn(hpp->buf, hpp->size, fmt, get_field(he));
if (symbol_conf.event_group) {
int prev_idx, idx_delta;
@@ -49,11 +55,15 @@ static int __hpp__percent_fmt(struct perf_hpp *hpp, struct hist_entry *he,
* have no sample
*/
ret += print_fn(hpp->buf + ret, hpp->size - ret,
- fmt, 0.0);
+ fmt, 0);
}
- ret += print_fn(hpp->buf + ret, hpp->size - ret,
- fmt, 100.0 * period / total);
+ if (fmt_percent)
+ ret += print_fn(hpp->buf + ret, hpp->size - ret,
+ fmt, 100.0 * period / total);
+ else
+ ret += print_fn(hpp->buf + ret, hpp->size - ret,
+ fmt, period);
prev_idx = perf_evsel__group_idx(evsel);
}
@@ -65,23 +75,12 @@ static int __hpp__percent_fmt(struct perf_hpp *hpp, struct hist_entry *he,
* zero-fill group members at last which have no sample
*/
ret += print_fn(hpp->buf + ret, hpp->size - ret,
- fmt, 0.0);
+ fmt, 0);
}
}
return ret;
}
-static int __hpp__raw_fmt(struct perf_hpp *hpp, struct hist_entry *he,
- u64 (*get_field)(struct hist_entry *),
- const char *fmt, hpp_snprint_fn print_fn)
-{
- int ret;
-
- ret = print_fn(hpp->buf, hpp->size, fmt, get_field(he));
- return ret;
-}
-
-
#define __HPP_HEADER_FN(_type, _str, _min_width, _unit_width) \
static int hpp__header_##_type(struct perf_hpp *hpp) \
{ \
@@ -116,16 +115,16 @@ static u64 he_get_##_field(struct hist_entry *he) \
\
static int hpp__color_##_type(struct perf_hpp *hpp, struct hist_entry *he) \
{ \
- return __hpp__percent_fmt(hpp, he, he_get_##_field, " %6.2f%%", \
- (hpp_snprint_fn)percent_color_snprintf); \
+ return __hpp__fmt(hpp, he, he_get_##_field, " %6.2f%%", \
+ (hpp_snprint_fn)percent_color_snprintf, true); \
}
#define __HPP_ENTRY_PERCENT_FN(_type, _field) \
static int hpp__entry_##_type(struct perf_hpp *hpp, struct hist_entry *he) \
{ \
const char *fmt = symbol_conf.field_sep ? " %.2f" : " %6.2f%%"; \
- return __hpp__percent_fmt(hpp, he, he_get_##_field, fmt, \
- scnprintf); \
+ return __hpp__fmt(hpp, he, he_get_##_field, fmt, \
+ scnprintf, true); \
}
#define __HPP_ENTRY_RAW_FN(_type, _field) \
@@ -137,7 +136,7 @@ static u64 he_get_raw_##_field(struct hist_entry *he) \
static int hpp__entry_##_type(struct perf_hpp *hpp, struct hist_entry *he) \
{ \
const char *fmt = symbol_conf.field_sep ? " %"PRIu64 : " %11"PRIu64; \
- return __hpp__raw_fmt(hpp, he, he_get_raw_##_field, fmt, scnprintf); \
+ return __hpp__fmt(hpp, he, he_get_raw_##_field, fmt, scnprintf, false); \
}
#define HPP_PERCENT_FNS(_type, _str, _field, _min_width, _unit_width) \
next prev parent reply other threads:[~2013-02-06 22:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 12:32 [PATCH 00/11] perf tool: Add PERF_SAMPLE_READ sample read support Jiri Olsa
2013-02-04 12:32 ` [PATCH 01/11] perf ui/hist: Add support to display whole group data for raw columns Jiri Olsa
2013-02-06 4:41 ` Namhyung Kim
2013-02-06 22:10 ` tip-bot for Jiri Olsa [this message]
2013-02-04 12:32 ` [PATCH 02/11] perf: Add PERF_EVENT_IOC_ID ioctl to return event ID Jiri Olsa
2013-05-02 13:38 ` Peter Zijlstra
2013-02-04 12:32 ` [PATCH 03/11] perf: Do not get values from disabled counters in group format read Jiri Olsa
2013-05-02 13:39 ` Peter Zijlstra
2013-02-04 12:32 ` [PATCH 04/11] perf tools: Use PERF_EVENT_IOC_ID perf ioctl to read event id Jiri Olsa
2013-02-04 12:32 ` [PATCH 05/11] perf tools: Add support for parsing PERF_SAMPLE_READ sample type Jiri Olsa
2013-02-04 12:33 ` [PATCH 06/11] perf tools: Fix event ID retrieval for group format read case Jiri Olsa
2013-02-04 12:33 ` [PATCH 07/11] perf tools: Add perf_evlist__id2sid function to get event ID related data Jiri Olsa
2013-02-04 12:33 ` [PATCH 08/11] perf tools: Add PERF_SAMPLE_READ sample related processing Jiri Olsa
2013-02-04 12:33 ` [PATCH 09/11] perf tools: Add 'S' event/group modifier to read sample value Jiri Olsa
2013-02-04 12:33 ` [PATCH 10/11] perf tests: Add attr record group sampling test Jiri Olsa
2013-02-04 12:33 ` [PATCH 11/11] perf tests: Add parse events tests for leader sampling Jiri Olsa
2013-02-06 4:59 ` [PATCH 00/11] perf tool: Add PERF_SAMPLE_READ sample read support 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=tip-0c5268bf2218144469dde3228f14898fadbbcdcd@git.kernel.org \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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