perf report: Fix alignment of symbol column when -v is given
[deliverable/linux.git] / tools / perf / util / hist.c
index 514fc0470e3888b18601cf095737d4ca3123df37..72b4eec820c3aac05f4c1990d596bf971afc102a 100644 (file)
@@ -70,9 +70,17 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
        int symlen;
        u16 len;
 
-       if (h->ms.sym)
-               hists__new_col_len(hists, HISTC_SYMBOL, h->ms.sym->namelen + 4);
-       else {
+       /*
+        * +4 accounts for '[x] ' priv level info
+        * +2 accounts for 0x prefix on raw addresses
+        * +3 accounts for ' y ' symtab origin info
+        */
+       if (h->ms.sym) {
+               symlen = h->ms.sym->namelen + 4;
+               if (verbose)
+                       symlen += BITS_PER_LONG / 4 + 2 + 3;
+               hists__new_col_len(hists, HISTC_SYMBOL, symlen);
+       } else {
                symlen = unresolved_col_width + 4 + 2;
                hists__new_col_len(hists, HISTC_SYMBOL, symlen);
                hists__set_unres_dso_col_len(hists, HISTC_DSO);
@@ -91,12 +99,10 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
                hists__new_col_len(hists, HISTC_PARENT, h->parent->namelen);
 
        if (h->branch_info) {
-               /*
-                * +4 accounts for '[x] ' priv level info
-                * +2 account of 0x prefix on raw addresses
-                */
                if (h->branch_info->from.sym) {
                        symlen = (int)h->branch_info->from.sym->namelen + 4;
+                       if (verbose)
+                               symlen += BITS_PER_LONG / 4 + 2 + 3;
                        hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen);
 
                        symlen = dso__name_len(h->branch_info->from.map->dso);
@@ -109,6 +115,8 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
 
                if (h->branch_info->to.sym) {
                        symlen = (int)h->branch_info->to.sym->namelen + 4;
+                       if (verbose)
+                               symlen += BITS_PER_LONG / 4 + 2 + 3;
                        hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen);
 
                        symlen = dso__name_len(h->branch_info->to.map->dso);
@@ -121,10 +129,6 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
        }
 
        if (h->mem_info) {
-               /*
-                * +4 accounts for '[x] ' priv level info
-                * +2 account of 0x prefix on raw addresses
-                */
                if (h->mem_info->daddr.sym) {
                        symlen = (int)h->mem_info->daddr.sym->namelen + 4
                               + unresolved_col_width + 2;
This page took 0.043858 seconds and 5 git commands to generate.