]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf hists: Update the column width for the "srcline" sort key
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 10 Aug 2015 19:53:54 +0000 (16:53 -0300)
committerLuis Henriques <luis.henriques@canonical.com>
Wed, 30 Sep 2015 12:20:39 +0000 (13:20 +0100)
commit e8e6d37e73e6b950c891c780745460b87f4755b6 upstream.

When we introduce a new sort key, we need to update the
hists__calc_col_len() function accordingly, otherwise the width
will be limited to strlen(header).

We can't update it when obtaining a line value for a column (for
instance, in sort__srcline_cmp()), because we reset it all when doing a
resort (see hists__output_recalc_col_len()), so we need to, from what is
in the hist_entry fields, set each of the column widths.

Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Fixes: 409a8be61560 ("perf tools: Add sort by src line/number")
Link: http://lkml.kernel.org/n/tip-jgbe0yx8v1gs89cslr93pvz2@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
tools/perf/util/hist.c

index 30df6187ee026acf0fb9f12013fbde891d3bdd70..e2a462bf582249cd10c417006eae75f81bd53586 100644 (file)
@@ -156,6 +156,9 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
        hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12);
        hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12);
 
+       if (h->srcline)
+               hists__new_col_len(hists, HISTC_SRCLINE, strlen(h->srcline));
+
        if (h->transaction)
                hists__new_col_len(hists, HISTC_TRANSACTION,
                                   hist_entry__transaction_len());