Skip to content

Commit eb037f1

Browse files
committed
Merge tag 'perf-tools-fixes-for-v6.1-2-2022-11-10' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
Pull perf tools fixes from Arnaldo Carvalho de Melo: - Fix 'perf stat' crash with --per-node --metric-only in CSV mode, due to the AGGR_NODE slot in the 'aggr_header_csv' array not being set. - Fix printing prefix in CSV output of 'perf stat' metrics in interval mode (-I), where an extra separator was being added to the start of some lines. - Fix skipping branch stack sampling 'perf test' entry, that was using both --branch-any and --branch-filter, which can't be used together. * tag 'perf-tools-fixes-for-v6.1-2-2022-11-10' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: perf tools: Add the include/perf/ directory to .gitignore perf test: Fix skipping branch stack sampling test perf stat: Fix printing os->prefix in CSV metrics output perf stat: Fix crash with --per-node --metric-only in CSV mode
2 parents 991f173 + 94d957a commit eb037f1

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

tools/perf/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ PERF-GUI-VARS
44
PERF-VERSION-FILE
55
FEATURE-DUMP
66
perf
7+
!include/perf/
78
perf-read-vdso32
89
perf-read-vdsox32
910
perf-help

tools/perf/tests/shell/test_brstack.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ fi
1313

1414
# skip the test if the hardware doesn't support branch stack sampling
1515
# and if the architecture doesn't support filter types: any,save_type,u
16-
perf record -b -o- -B --branch-filter any,save_type,u true > /dev/null 2>&1 || exit 2
16+
if ! perf record -o- --no-buildid --branch-filter any,save_type,u -- true > /dev/null 2>&1 ; then
17+
echo "skip: system doesn't support filter types: any,save_type,u"
18+
exit 2
19+
fi
1720

1821
TMPDIR=$(mktemp -d /tmp/__perf_test.program.XXXXX)
1922

tools/perf/util/parse-branch-options.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ parse_branch_stack(const struct option *opt, const char *str, int unset)
102102
/*
103103
* cannot set it twice, -b + --branch-filter for instance
104104
*/
105-
if (*mode)
105+
if (*mode) {
106+
pr_err("Error: Can't use --branch-any (-b) with --branch-filter (-j).\n");
106107
return -1;
108+
}
107109

108110
return parse_branch_str(str, mode);
109111
}

tools/perf/util/stat-display.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static void new_line_csv(struct perf_stat_config *config, void *ctx)
273273

274274
fputc('\n', os->fh);
275275
if (os->prefix)
276-
fprintf(os->fh, "%s%s", os->prefix, config->csv_sep);
276+
fprintf(os->fh, "%s", os->prefix);
277277
aggr_printout(config, os->evsel, os->id, os->nr);
278278
for (i = 0; i < os->nfields; i++)
279279
fputs(config->csv_sep, os->fh);
@@ -559,7 +559,7 @@ static void printout(struct perf_stat_config *config, struct aggr_cpu_id id, int
559559
[AGGR_CORE] = 2,
560560
[AGGR_THREAD] = 1,
561561
[AGGR_UNSET] = 0,
562-
[AGGR_NODE] = 0,
562+
[AGGR_NODE] = 1,
563563
};
564564

565565
pm = config->metric_only ? print_metric_only_csv : print_metric_csv;
@@ -1124,6 +1124,7 @@ static int aggr_header_lens[] = {
11241124
[AGGR_SOCKET] = 12,
11251125
[AGGR_NONE] = 6,
11261126
[AGGR_THREAD] = 24,
1127+
[AGGR_NODE] = 6,
11271128
[AGGR_GLOBAL] = 0,
11281129
};
11291130

@@ -1133,6 +1134,7 @@ static const char *aggr_header_csv[] = {
11331134
[AGGR_SOCKET] = "socket,cpus",
11341135
[AGGR_NONE] = "cpu,",
11351136
[AGGR_THREAD] = "comm-pid,",
1137+
[AGGR_NODE] = "node,",
11361138
[AGGR_GLOBAL] = ""
11371139
};
11381140

0 commit comments

Comments
 (0)