Skip to content

Commit

Permalink
Merge tag 'perf-tools-fixes-for-v6.1-2-2022-11-10' of git://git.kerne…
Browse files Browse the repository at this point in the history
…l.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
  • Loading branch information
torvalds committed Nov 11, 2022
2 parents 991f173 + 94d957a commit eb037f1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions tools/perf/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PERF-GUI-VARS
PERF-VERSION-FILE
FEATURE-DUMP
perf
!include/perf/
perf-read-vdso32
perf-read-vdsox32
perf-help
Expand Down
5 changes: 4 additions & 1 deletion tools/perf/tests/shell/test_brstack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ fi

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

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

Expand Down
4 changes: 3 additions & 1 deletion tools/perf/util/parse-branch-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ parse_branch_stack(const struct option *opt, const char *str, int unset)
/*
* cannot set it twice, -b + --branch-filter for instance
*/
if (*mode)
if (*mode) {
pr_err("Error: Can't use --branch-any (-b) with --branch-filter (-j).\n");
return -1;
}

return parse_branch_str(str, mode);
}
6 changes: 4 additions & 2 deletions tools/perf/util/stat-display.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ static void new_line_csv(struct perf_stat_config *config, void *ctx)

fputc('\n', os->fh);
if (os->prefix)
fprintf(os->fh, "%s%s", os->prefix, config->csv_sep);
fprintf(os->fh, "%s", os->prefix);
aggr_printout(config, os->evsel, os->id, os->nr);
for (i = 0; i < os->nfields; i++)
fputs(config->csv_sep, os->fh);
Expand Down Expand Up @@ -559,7 +559,7 @@ static void printout(struct perf_stat_config *config, struct aggr_cpu_id id, int
[AGGR_CORE] = 2,
[AGGR_THREAD] = 1,
[AGGR_UNSET] = 0,
[AGGR_NODE] = 0,
[AGGR_NODE] = 1,
};

pm = config->metric_only ? print_metric_only_csv : print_metric_csv;
Expand Down Expand Up @@ -1124,6 +1124,7 @@ static int aggr_header_lens[] = {
[AGGR_SOCKET] = 12,
[AGGR_NONE] = 6,
[AGGR_THREAD] = 24,
[AGGR_NODE] = 6,
[AGGR_GLOBAL] = 0,
};

Expand All @@ -1133,6 +1134,7 @@ static const char *aggr_header_csv[] = {
[AGGR_SOCKET] = "socket,cpus",
[AGGR_NONE] = "cpu,",
[AGGR_THREAD] = "comm-pid,",
[AGGR_NODE] = "node,",
[AGGR_GLOBAL] = ""
};

Expand Down

0 comments on commit eb037f1

Please sign in to comment.