From: Jiri Olsa <[email protected]>

Using resort callbacks to compute the columns' width.

Computing only the global ones, c2c entries have fixed width only.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Joe Mario <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/builtin-c2c.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 2f3e430ddde0..473dae1baed8 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -1728,11 +1728,21 @@ static inline int valid_hitm_or_store(struct hist_entry 
*he)
        return has_hitm || c2c_he->stats.store;
 }
 
+static void calc_width(struct hist_entry *he)
+{
+       struct c2c_hists *c2c_hists;
+
+       c2c_hists = container_of(he->hists, struct c2c_hists, hists);
+       hists__calc_col_len(&c2c_hists->hists, he);
+}
+
 static int filter_cb(struct hist_entry *he)
 {
        if (c2c.show_src && !he->srcline)
                he->srcline = hist_entry__get_srcline(he);
 
+       calc_width(he);
+
        if (!valid_hitm_or_store(he))
                he->filtered = HIST_FILTER__C2C;
 
@@ -1748,6 +1758,8 @@ static int resort_cl_cb(struct hist_entry *he)
        c2c_he = container_of(he, struct c2c_hist_entry, he);
        c2c_hists = c2c_he->hists;
 
+       calc_width(he);
+
        if (display && c2c_hists) {
                c2c_hists__reinit(c2c_hists, c2c.cl_output, c2c.cl_resort);
 
-- 
2.7.4

Reply via email to