From: Kan Liang <[email protected]>

If group option is set, perf report shows the values from each events in
the same group one by one. However, sometimes only leader's value is
enough. For example, we only caculate and store the freq value for
leader.

Signed-off-by: Kan Liang <[email protected]>
---
 tools/perf/ui/hist.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 25d6083..c37aa6f 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -17,7 +17,7 @@
 
 static int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
                      hpp_field_fn get_field, const char *fmt, int len,
-                     hpp_snprint_fn print_fn, bool fmt_percent)
+                     hpp_snprint_fn print_fn, bool fmt_percent, bool 
leader_only)
 {
        int ret;
        struct hists *hists = he->hists;
@@ -36,7 +36,7 @@ static int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry 
*he,
        } else
                ret = hpp__call_print_fn(hpp, print_fn, fmt, len, 
get_field(he));
 
-       if (perf_evsel__is_group_event(evsel)) {
+       if (perf_evsel__is_group_event(evsel) && !leader_only) {
                int prev_idx, idx_delta;
                struct hist_entry *pair;
                int nr_members = evsel->nr_members;
@@ -109,10 +109,11 @@ int hpp__fmt(struct perf_hpp_fmt *fmt, struct perf_hpp 
*hpp,
             const char *fmtstr, hpp_snprint_fn print_fn, bool fmt_percent)
 {
        int len = fmt->user_len ?: fmt->len;
+       bool leader_only = false;
 
        if (symbol_conf.field_sep) {
                return __hpp__fmt(hpp, he, get_field, fmtstr, 1,
-                                 print_fn, fmt_percent);
+                                 print_fn, fmt_percent, leader_only);
        }
 
        if (fmt_percent)
@@ -120,7 +121,7 @@ int hpp__fmt(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
        else
                len -= 1;
 
-       return  __hpp__fmt(hpp, he, get_field, fmtstr, len, print_fn, 
fmt_percent);
+       return  __hpp__fmt(hpp, he, get_field, fmtstr, len, print_fn, 
fmt_percent, leader_only);
 }
 
 int hpp__fmt_acc(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to