diff options
Diffstat (limited to 'tools/perf/util/sort.c')
-rw-r--r-- | tools/perf/util/sort.c | 107 |
1 files changed, 60 insertions, 47 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 901b9bece2ee..45512baaab67 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -1061,6 +1061,7 @@ static struct hpp_dimension hpp_sort_dimensions[] = { | |||
1061 | DIM(PERF_HPP__OVERHEAD_US, "overhead_us"), | 1061 | DIM(PERF_HPP__OVERHEAD_US, "overhead_us"), |
1062 | DIM(PERF_HPP__OVERHEAD_GUEST_SYS, "overhead_guest_sys"), | 1062 | DIM(PERF_HPP__OVERHEAD_GUEST_SYS, "overhead_guest_sys"), |
1063 | DIM(PERF_HPP__OVERHEAD_GUEST_US, "overhead_guest_us"), | 1063 | DIM(PERF_HPP__OVERHEAD_GUEST_US, "overhead_guest_us"), |
1064 | DIM(PERF_HPP__OVERHEAD_ACC, "overhead_children"), | ||
1064 | DIM(PERF_HPP__SAMPLES, "sample"), | 1065 | DIM(PERF_HPP__SAMPLES, "sample"), |
1065 | DIM(PERF_HPP__PERIOD, "period"), | 1066 | DIM(PERF_HPP__PERIOD, "period"), |
1066 | }; | 1067 | }; |
@@ -1156,6 +1157,7 @@ __sort_dimension__alloc_hpp(struct sort_dimension *sd) | |||
1156 | 1157 | ||
1157 | INIT_LIST_HEAD(&hse->hpp.list); | 1158 | INIT_LIST_HEAD(&hse->hpp.list); |
1158 | INIT_LIST_HEAD(&hse->hpp.sort_list); | 1159 | INIT_LIST_HEAD(&hse->hpp.sort_list); |
1160 | hse->hpp.elide = false; | ||
1159 | 1161 | ||
1160 | return hse; | 1162 | return hse; |
1161 | } | 1163 | } |
@@ -1363,27 +1365,64 @@ static int __setup_sorting(void) | |||
1363 | return ret; | 1365 | return ret; |
1364 | } | 1366 | } |
1365 | 1367 | ||
1366 | bool perf_hpp__should_skip(struct perf_hpp_fmt *format) | 1368 | void perf_hpp__set_elide(int idx, bool elide) |
1367 | { | 1369 | { |
1368 | if (perf_hpp__is_sort_entry(format)) { | 1370 | struct perf_hpp_fmt *fmt; |
1369 | struct hpp_sort_entry *hse; | 1371 | struct hpp_sort_entry *hse; |
1372 | |||
1373 | perf_hpp__for_each_format(fmt) { | ||
1374 | if (!perf_hpp__is_sort_entry(fmt)) | ||
1375 | continue; | ||
1370 | 1376 | ||
1371 | hse = container_of(format, struct hpp_sort_entry, hpp); | 1377 | hse = container_of(fmt, struct hpp_sort_entry, hpp); |
1372 | return hse->se->elide; | 1378 | if (hse->se->se_width_idx == idx) { |
1379 | fmt->elide = elide; | ||
1380 | break; | ||
1381 | } | ||
1373 | } | 1382 | } |
1374 | return false; | ||
1375 | } | 1383 | } |
1376 | 1384 | ||
1377 | static void sort_entry__setup_elide(struct sort_entry *se, | 1385 | static bool __get_elide(struct strlist *list, const char *list_name, FILE *fp) |
1378 | struct strlist *list, | ||
1379 | const char *list_name, FILE *fp) | ||
1380 | { | 1386 | { |
1381 | if (list && strlist__nr_entries(list) == 1) { | 1387 | if (list && strlist__nr_entries(list) == 1) { |
1382 | if (fp != NULL) | 1388 | if (fp != NULL) |
1383 | fprintf(fp, "# %s: %s\n", list_name, | 1389 | fprintf(fp, "# %s: %s\n", list_name, |
1384 | strlist__entry(list, 0)->s); | 1390 | strlist__entry(list, 0)->s); |
1385 | se->elide = true; | 1391 | return true; |
1386 | } | 1392 | } |
1393 | return false; | ||
1394 | } | ||
1395 | |||
1396 | static bool get_elide(int idx, FILE *output) | ||
1397 | { | ||
1398 | switch (idx) { | ||
1399 | case HISTC_SYMBOL: | ||
1400 | return __get_elide(symbol_conf.sym_list, "symbol", output); | ||
1401 | case HISTC_DSO: | ||
1402 | return __get_elide(symbol_conf.dso_list, "dso", output); | ||
1403 | case HISTC_COMM: | ||
1404 | return __get_elide(symbol_conf.comm_list, "comm", output); | ||
1405 | default: | ||
1406 | break; | ||
1407 | } | ||
1408 | |||
1409 | if (sort__mode != SORT_MODE__BRANCH) | ||
1410 | return false; | ||
1411 | |||
1412 | switch (idx) { | ||
1413 | case HISTC_SYMBOL_FROM: | ||
1414 | return __get_elide(symbol_conf.sym_from_list, "sym_from", output); | ||
1415 | case HISTC_SYMBOL_TO: | ||
1416 | return __get_elide(symbol_conf.sym_to_list, "sym_to", output); | ||
1417 | case HISTC_DSO_FROM: | ||
1418 | return __get_elide(symbol_conf.dso_from_list, "dso_from", output); | ||
1419 | case HISTC_DSO_TO: | ||
1420 | return __get_elide(symbol_conf.dso_to_list, "dso_to", output); | ||
1421 | default: | ||
1422 | break; | ||
1423 | } | ||
1424 | |||
1425 | return false; | ||
1387 | } | 1426 | } |
1388 | 1427 | ||
1389 | void sort__setup_elide(FILE *output) | 1428 | void sort__setup_elide(FILE *output) |
@@ -1391,39 +1430,12 @@ void sort__setup_elide(FILE *output) | |||
1391 | struct perf_hpp_fmt *fmt; | 1430 | struct perf_hpp_fmt *fmt; |
1392 | struct hpp_sort_entry *hse; | 1431 | struct hpp_sort_entry *hse; |
1393 | 1432 | ||
1394 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | 1433 | perf_hpp__for_each_format(fmt) { |
1395 | "dso", output); | 1434 | if (!perf_hpp__is_sort_entry(fmt)) |
1396 | sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list, | 1435 | continue; |
1397 | "comm", output); | 1436 | |
1398 | sort_entry__setup_elide(&sort_sym, symbol_conf.sym_list, | 1437 | hse = container_of(fmt, struct hpp_sort_entry, hpp); |
1399 | "symbol", output); | 1438 | fmt->elide = get_elide(hse->se->se_width_idx, output); |
1400 | |||
1401 | if (sort__mode == SORT_MODE__BRANCH) { | ||
1402 | sort_entry__setup_elide(&sort_dso_from, | ||
1403 | symbol_conf.dso_from_list, | ||
1404 | "dso_from", output); | ||
1405 | sort_entry__setup_elide(&sort_dso_to, | ||
1406 | symbol_conf.dso_to_list, | ||
1407 | "dso_to", output); | ||
1408 | sort_entry__setup_elide(&sort_sym_from, | ||
1409 | symbol_conf.sym_from_list, | ||
1410 | "sym_from", output); | ||
1411 | sort_entry__setup_elide(&sort_sym_to, | ||
1412 | symbol_conf.sym_to_list, | ||
1413 | "sym_to", output); | ||
1414 | } else if (sort__mode == SORT_MODE__MEMORY) { | ||
1415 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1416 | "symbol_daddr", output); | ||
1417 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1418 | "dso_daddr", output); | ||
1419 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1420 | "mem", output); | ||
1421 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1422 | "local_weight", output); | ||
1423 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1424 | "tlb", output); | ||
1425 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1426 | "snoop", output); | ||
1427 | } | 1439 | } |
1428 | 1440 | ||
1429 | /* | 1441 | /* |
@@ -1434,8 +1446,7 @@ void sort__setup_elide(FILE *output) | |||
1434 | if (!perf_hpp__is_sort_entry(fmt)) | 1446 | if (!perf_hpp__is_sort_entry(fmt)) |
1435 | continue; | 1447 | continue; |
1436 | 1448 | ||
1437 | hse = container_of(fmt, struct hpp_sort_entry, hpp); | 1449 | if (!fmt->elide) |
1438 | if (!hse->se->elide) | ||
1439 | return; | 1450 | return; |
1440 | } | 1451 | } |
1441 | 1452 | ||
@@ -1443,8 +1454,7 @@ void sort__setup_elide(FILE *output) | |||
1443 | if (!perf_hpp__is_sort_entry(fmt)) | 1454 | if (!perf_hpp__is_sort_entry(fmt)) |
1444 | continue; | 1455 | continue; |
1445 | 1456 | ||
1446 | hse = container_of(fmt, struct hpp_sort_entry, hpp); | 1457 | fmt->elide = false; |
1447 | hse->se->elide = false; | ||
1448 | } | 1458 | } |
1449 | } | 1459 | } |
1450 | 1460 | ||
@@ -1581,6 +1591,9 @@ void reset_output_field(void) | |||
1581 | sort__has_sym = 0; | 1591 | sort__has_sym = 0; |
1582 | sort__has_dso = 0; | 1592 | sort__has_dso = 0; |
1583 | 1593 | ||
1594 | field_order = NULL; | ||
1595 | sort_order = NULL; | ||
1596 | |||
1584 | reset_dimensions(); | 1597 | reset_dimensions(); |
1585 | perf_hpp__reset_output_field(); | 1598 | perf_hpp__reset_output_field(); |
1586 | } | 1599 | } |