Skip to contentSkip to conversation

perf archive: Fix filtering of empty build-ids

PATCH Applied Nicholas Fraser 3 participants 3 messages Feb 19, 2021 – Mar 3, 2021 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 perf archive: Fix filtering of empty build-ids

A non-existent build-id used to be treated as all-zero SHA-1 hash. Build-ids are now variable width. A non-existent build-id is an empty string and "perf buildid-list" pads this with spaces. This is true even when using old perf.data files recorded from older versions of perf; "perf buildid-list" never reports an all-zero hash anymore.

This fixes "perf-archive" to skip missing build-ids by skipping lines that start with a padding space rather than with zeroes.

---
 tools/perf/perf-archive.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/perf-archive.sh +1 -2
index 0cfb3e2cefef..133f0eddbcc4 100644
@@ -20,9 +20,8 @@ else
 fi
 
 BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
-NOBUILDID=0000000000000000000000000000000000000000
 
-perf buildid-list -i $PERF_DATA --with-hits | grep -v "^$NOBUILDID " > $BUILDIDS
+perf buildid-list -i $PERF_DATA --with-hits | grep -v "^ " > $BUILDIDS
 if [ ! -s $BUILDIDS ] ; then
 	echo "perf archive: no build-ids found"
 	rm $BUILDIDS || true
Signature · 1 line
2.30.1
Acked-by on v1 1/2
#1 lore raw
Quoted 10 lines · Nicholas Fraser

A non-existent build-id used to be treated as all-zero SHA-1 hash. Build-ids are now variable width. A non-existent build-id is an empty string and "perf buildid-list" pads this with spaces. This is true even when using old perf.data files recorded from older versions of perf; "perf buildid-list" never reports an all-zero hash anymore.

This fixes "perf-archive" to skip missing build-ids by skipping lines that start with a padding space rather than with zeroes.

thanks,
jirka

Quoted 22 lines
---
 tools/perf/perf-archive.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/perf-archive.sh +1 -2
index 0cfb3e2cefef..133f0eddbcc4 100644
@@ -20,9 +20,8 @@ else
 fi
 
 BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
-NOBUILDID=0000000000000000000000000000000000000000
 
-perf buildid-list -i $PERF_DATA --with-hits | grep -v "^$NOBUILDID " > $BUILDIDS
+perf buildid-list -i $PERF_DATA --with-hits | grep -v "^ " > $BUILDIDS
 if [ ! -s $BUILDIDS ] ; then
 	echo "perf archive: no build-ids found"
 	rm $BUILDIDS || true
Signature · 1 line
2.30.1
maintainer Applied
#2 lore raw

Em Wed, Feb 24, 2021 at 02:50:20PM +0100, Jiri Olsa escreveu:

Quoted 7 lines · Nicholas Fraser
Quoted 6 lines

A non-existent build-id used to be treated as all-zero SHA-1 hash. Build-ids are now variable width. A non-existent build-id is an empty string and "perf buildid-list" pads this with spaces. This is true even when using old perf.data files recorded from older versions of perf; "perf buildid-list" never reports an all-zero hash anymore.

Quoted 6 lines
Quoted 4 lines

This fixes "perf-archive" to skip missing build-ids by skipping lines that start with a padding space rather than with zeroes.

Thanks, applied.

- Arnaldo

Quoted 26 lines

thanks,
jirka

Quoted 22 lines
---
 tools/perf/perf-archive.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/perf-archive.sh +1 -2
index 0cfb3e2cefef..133f0eddbcc4 100644
@@ -20,9 +20,8 @@ else
 fi
 
 BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
-NOBUILDID=0000000000000000000000000000000000000000
 
-perf buildid-list -i $PERF_DATA --with-hits | grep -v "^$NOBUILDID " > $BUILDIDS
+perf buildid-list -i $PERF_DATA --with-hits | grep -v "^ " > $BUILDIDS
 if [ ! -s $BUILDIDS ] ; then
 	echo "perf archive: no build-ids found"
 	rm $BUILDIDS || true
Signature · 1 line
2.30.1
Signature · 1 line
- Arnaldo