aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2014-05-19 01:19:30 -0400
committerJiri Olsa <jolsa@kernel.org>2014-05-21 05:45:37 -0400
commitcfaa154b2335d4c8efdfcb65d9b12e944d1b74a6 (patch)
tree3f97496565bfcd29313393ce7bfa1f7d3308d52a /tools/perf/ui
parent678a500d076ec873b8809041c6b718653db2a75f (diff)
perf tools: Get rid of obsolete hist_entry__sort_list
Now we moved to the perf_hpp_[_sort]_list so no need to keep the old hist_entry__sort_list and sort__first_dimension. Also the hist_entry__sort_snprintf() can be gone as hist_entry__snprintf() provides the functionality. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1400480762-22852-18-git-send-email-namhyung@kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r--tools/perf/ui/hist.c36
-rw-r--r--tools/perf/ui/stdio/hist.c22
2 files changed, 24 insertions, 34 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index b114c6668865..61cf31e094f3 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -459,47 +459,29 @@ next:
459 } 459 }
460} 460}
461 461
462int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,
463 struct hists *hists)
464{
465 const char *sep = symbol_conf.field_sep;
466 struct sort_entry *se;
467 int ret = 0;
468
469 list_for_each_entry(se, &hist_entry__sort_list, list) {
470 if (se->elide)
471 continue;
472
473 ret += scnprintf(s + ret, size - ret, "%s", sep ?: " ");
474 ret += se->se_snprintf(he, s + ret, size - ret,
475 hists__col_len(hists, se->se_width_idx));
476 }
477
478 return ret;
479}
480
481/* 462/*
482 * See hists__fprintf to match the column widths 463 * See hists__fprintf to match the column widths
483 */ 464 */
484unsigned int hists__sort_list_width(struct hists *hists) 465unsigned int hists__sort_list_width(struct hists *hists)
485{ 466{
486 struct perf_hpp_fmt *fmt; 467 struct perf_hpp_fmt *fmt;
487 struct sort_entry *se; 468 int ret = 0;
488 int i = 0, ret = 0; 469 bool first = true;
489 struct perf_hpp dummy_hpp; 470 struct perf_hpp dummy_hpp;
490 471
491 perf_hpp__for_each_format(fmt) { 472 perf_hpp__for_each_format(fmt) {
492 if (i) 473 if (perf_hpp__should_skip(fmt))
474 continue;
475
476 if (first)
477 first = false;
478 else
493 ret += 2; 479 ret += 2;
494 480
495 ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists)); 481 ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists));
496 } 482 }
497 483
498 list_for_each_entry(se, &hist_entry__sort_list, list) 484 if (verbose && sort__has_sym) /* Addr + origin */
499 if (!se->elide)
500 ret += 2 + hists__col_len(hists, se->se_width_idx);
501
502 if (verbose) /* Addr + origin */
503 ret += 3 + BITS_PER_LONG / 4; 485 ret += 3 + BITS_PER_LONG / 4;
504 486
505 return ret; 487 return ret;
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index cfcd3f6fd1c5..9f57991025a9 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -183,7 +183,8 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
183 * the symbol. No need to print it otherwise it appears as 183 * the symbol. No need to print it otherwise it appears as
184 * displayed twice. 184 * displayed twice.
185 */ 185 */
186 if (!i++ && sort__first_dimension == SORT_SYM) 186 if (!i++ && field_order == NULL &&
187 sort_order && !prefixcmp(sort_order, "sym"))
187 continue; 188 continue;
188 if (!printed) { 189 if (!printed) {
189 ret += callchain__fprintf_left_margin(fp, left_margin); 190 ret += callchain__fprintf_left_margin(fp, left_margin);
@@ -296,13 +297,20 @@ static size_t hist_entry__callchain_fprintf(struct hist_entry *he,
296 int left_margin = 0; 297 int left_margin = 0;
297 u64 total_period = hists->stats.total_period; 298 u64 total_period = hists->stats.total_period;
298 299
299 if (sort__first_dimension == SORT_COMM) { 300 if (field_order == NULL && (sort_order == NULL ||
300 struct sort_entry *se = list_first_entry(&hist_entry__sort_list, 301 !prefixcmp(sort_order, "comm"))) {
301 typeof(*se), list); 302 struct perf_hpp_fmt *fmt;
302 left_margin = hists__col_len(hists, se->se_width_idx); 303
303 left_margin -= thread__comm_len(he->thread); 304 perf_hpp__for_each_format(fmt) {
304 } 305 if (!perf_hpp__is_sort_entry(fmt))
306 continue;
305 307
308 /* must be 'comm' sort entry */
309 left_margin = fmt->width(fmt, NULL, hists_to_evsel(hists));
310 left_margin -= thread__comm_len(he->thread);
311 break;
312 }
313 }
306 return hist_entry_callchain__fprintf(he, total_period, left_margin, fp); 314 return hist_entry_callchain__fprintf(he, total_period, left_margin, fp);
307} 315}
308 316