Skip to contentSkip to conversation

perf/urgent fixes

GIT PULL New Arnaldo Carvalho de Melo 2 participants 4 messages Jul 28, 2015 – Jul 31, 2015 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 00a2916f7f82c348a2a94dbb572874173bc308a3:

perf: Fix running time accounting (2015-07-27 13:52:19 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo

for you to fetch changes up to 0927beeca5f9d1a7978f8da9c9d28647859816d3:

perf tools: Fix test build error when bindir contains double slash (2015-07-28 13:03:49 -0300)

----------------------------------------------------------------
perf/urgent fixes:

User visible:

- Fix 'perf stat' transaction lenght metrics (Andi Kleen)

Developer visible:

- Fix test build error when bindir contains double slash (Pawel Moll)

----------------------------------------------------------------
Andi Kleen (1):
perf stat: Fix transaction lenght metrics

Pawel Moll (1):
perf tools: Fix test build error when bindir contains double slash

 tools/perf/config/Makefile    | 2 +-
 tools/perf/util/stat-shadow.c | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)
author maintainer
#1 lore raw

PATCH 1/2 perf stat: Fix transaction lenght metrics

From: Andi Kleen <[email protected]>

The transaction length metrics in perf stat -T broke recently.

It would not match the metric correctly and always print K/sec.

This was caused by a incorrect update of the cycles_in_tx statistics.

Update the correct variable.

Also the check for zero division was reversed, which resulted in K/sec being printed for no transactions. Fix this also up.

---
 tools/perf/util/stat-shadow.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
tools/perf/util/stat-shadow.c +3 -5
index 53e8bb7bc852..2a5d8d7698ae 100644
@@ -85,7 +85,7 @@ void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count,
 	else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES))
 		update_stats(&runtime_cycles_stats[ctx][cpu], count[0]);
 	else if (perf_stat_evsel__is(counter, CYCLES_IN_TX))
-		update_stats(&runtime_transaction_stats[ctx][cpu], count[0]);
+		update_stats(&runtime_cycles_in_tx_stats[ctx][cpu], count[0]);
 	else if (perf_stat_evsel__is(counter, TRANSACTION_START))
 		update_stats(&runtime_transaction_stats[ctx][cpu], count[0]);
 	else if (perf_stat_evsel__is(counter, ELISION_START))
@@ -398,20 +398,18 @@ void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel,
 				" #   %5.2f%% aborted cycles         ",
 				100.0 * ((total2-avg) / total));
 	} else if (perf_stat_evsel__is(evsel, TRANSACTION_START) &&
-		   avg > 0 &&
 		   runtime_cycles_in_tx_stats[ctx][cpu].n != 0) {
 		total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]);
 
-		if (total)
+		if (avg)
 			ratio = total / avg;
 
 		fprintf(out, " # %8.0f cycles / transaction   ", ratio);
 	} else if (perf_stat_evsel__is(evsel, ELISION_START) &&
-		   avg > 0 &&
 		   runtime_cycles_in_tx_stats[ctx][cpu].n != 0) {
 		total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]);
 
-		if (total)
+		if (avg)
 			ratio = total / avg;
 
 		fprintf(out, " # %8.0f cycles / elision       ", ratio);
Signature · 1 line
2.1.0
author maintainer
#2 lore raw

PATCH 2/2 perf tools: Fix test build error when bindir contains double slash

In reply to Arnaldo Carvalho de Melo

From: Pawel Moll <[email protected]>

When building with a prefix ending with a slash, for example:

	$ make prefix=/usr/local/

one of the perf tests fail to compile due to BUILD_STR macro mishandling bindir_SQ string containing with two slashes:

	-DBINDIR="BUILD_STR(/usr/local//bin)"

with the following error:

	  CC       tests/attr.o
	tests/attr.c: In function ‘test__attr’:
	tests/attr.c:168:50: error: expected ‘)’ before ‘;’ token
	  snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR);
                                                  ^
	tests/attr.c:176:1: error: expected ‘;’ before ‘}’ token
	 }
	 ^
	tests/attr.c:176:1: error: control reaches end of non-void function [-Werror=return-type]
	 }
	 ^
	cc1: all warnings being treated as errors

This patch works around the problem by "cleaning" the bindir string using make's abspath function.

---
 tools/perf/config/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/config/Makefile +1 -1
index 094ddaee104c..d31fac19c30b 100644
@@ -638,7 +638,7 @@ ifndef DESTDIR
 prefix ?= $(HOME)
 endif
 bindir_relative = bin
-bindir = $(prefix)/$(bindir_relative)
+bindir = $(abspath $(prefix)/$(bindir_relative))
 mandir = share/man
 infodir = share/info
 perfexecdir = libexec/perf-core
Signature · 1 line
2.1.0
#3 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 35 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 00a2916f7f82c348a2a94dbb572874173bc308a3:

perf: Fix running time accounting (2015-07-27 13:52:19 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo

for you to fetch changes up to 0927beeca5f9d1a7978f8da9c9d28647859816d3:

perf tools: Fix test build error when bindir contains double slash (2015-07-28 13:03:49 -0300)

----------------------------------------------------------------
perf/urgent fixes:

User visible:

- Fix 'perf stat' transaction lenght metrics (Andi Kleen)

Developer visible:

- Fix test build error when bindir contains double slash (Pawel Moll)

----------------------------------------------------------------
Andi Kleen (1):
perf stat: Fix transaction lenght metrics

Quoted 6 lines

Pawel Moll (1):
perf tools: Fix test build error when bindir contains double slash

 tools/perf/config/Makefile    | 2 +-
 tools/perf/util/stat-shadow.c | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

Pulled, thanks Arnaldo!

Ingo