Commit eb037f16 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'perf-tools-fixes-for-v6.1-2-2022-11-10' of...

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
parents 991f173c 94d957ae
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ PERF-GUI-VARS
PERF-VERSION-FILE
FEATURE-DUMP
perf
!include/perf/
perf-read-vdso32
perf-read-vdsox32
perf-help
+4 −1
Original line number Diff line number Diff line
@@ -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)

+3 −1
Original line number Diff line number Diff line
@@ -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);
}
+4 −2
Original line number Diff line number Diff line
@@ -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);
@@ -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;
@@ -1124,6 +1124,7 @@ static int aggr_header_lens[] = {
	[AGGR_SOCKET] = 12,
	[AGGR_NONE] = 6,
	[AGGR_THREAD] = 24,
	[AGGR_NODE] = 6,
	[AGGR_GLOBAL] = 0,
};

@@ -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] 	=	""
};