diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-11-11 09:45:30 -0800 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-11-11 09:45:30 -0800 | 
| commit | eb037f16f7e843722db5f0275d84b3f738d5649d (patch) | |
| tree | 6b016100a8ac4e03ab01b22cc8d8bf1c78ad154d | |
| parent | 991f173cd23cea2b4102cb78f779a7a43c29e76f (diff) | |
| parent | 94d957ae513fc420d0a5a9bac815eb49ffebb56f (diff) | |
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
| -rw-r--r-- | tools/perf/.gitignore | 1 | ||||
| -rwxr-xr-x | tools/perf/tests/shell/test_brstack.sh | 5 | ||||
| -rw-r--r-- | tools/perf/util/parse-branch-options.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/stat-display.c | 6 | 
4 files changed, 12 insertions, 4 deletions
| diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore index a653311d9693..fd7a6ff9e7aa 100644 --- a/tools/perf/.gitignore +++ b/tools/perf/.gitignore @@ -4,6 +4,7 @@ PERF-GUI-VARS  PERF-VERSION-FILE  FEATURE-DUMP  perf +!include/perf/  perf-read-vdso32  perf-read-vdsox32  perf-help diff --git a/tools/perf/tests/shell/test_brstack.sh b/tools/perf/tests/shell/test_brstack.sh index ec801cffae6b..d7ff5c4b4da4 100755 --- a/tools/perf/tests/shell/test_brstack.sh +++ b/tools/perf/tests/shell/test_brstack.sh @@ -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) diff --git a/tools/perf/util/parse-branch-options.c b/tools/perf/util/parse-branch-options.c index 00588b9db474..31faf2bb49ff 100644 --- a/tools/perf/util/parse-branch-options.c +++ b/tools/perf/util/parse-branch-options.c @@ -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);  } diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 5c47ee9963a7..ba66bb7fc1ca 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -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] 	=	""  }; | 
