linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] perf archive: Add new option '--all'
@ 2023-12-12 16:59 vmolnaro
  2023-12-12 16:59 ` [PATCH 2/2] perf archive: Add new option '--unpack' vmolnaro
  2023-12-12 18:06 ` [PATCH 1/2] perf archive: Add new option '--all' Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 4+ messages in thread
From: vmolnaro @ 2023-12-12 16:59 UTC (permalink / raw)
  To: linux-perf-users, acme, acme, vmolnaro; +Cc: mpetlan

From: Veronika Molnarova <vmolnaro@redhat.com>

Perf archive has limited functionality and people from Red Hat Global
Support Services sent a request for a new feature that would pack
perf.data file together with an archive with debug symbols created by
the command 'perf archive' as customers were being confused and often
would forget to send perf.data file with the debug symbols.

Perf archive now accepts an option '--all' that generates archive
'perf.all-hostname-date-time.tar.bz2' that holds file 'perf.data' and
a sub-tar 'perf.symbols.tar.bz2' with debug symbols. The functionality of
the command 'perf archive' was not changed.

Signed-off-by: Veronika Molnarova <vmolnaro@redhat.com>
---
 tools/perf/perf-archive.sh | 40 ++++++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 8 deletions(-)
 mode change 100644 => 100755 tools/perf/perf-archive.sh

diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh
old mode 100644
new mode 100755
index 133f0eddbcc4..a92042eae95a
--- a/tools/perf/perf-archive.sh
+++ b/tools/perf/perf-archive.sh
@@ -4,9 +4,19 @@
 # Arnaldo Carvalho de Melo <acme@redhat.com>
 
 PERF_DATA=perf.data
-if [ $# -ne 0 ] ; then
-	PERF_DATA=$1
-fi
+PERF_SYMBOLS=perf.symbols
+PERF_ALL=perf.all
+ALL=0
+
+while [ $# -gt 0 ] ; do
+	if [ $1 == "--all" ]; then
+		ALL=1
+		shift
+	else
+		PERF_DATA=$1
+		shift
+	fi
+done
 
 #
 # PERF_BUILDID_DIR environment variable set by perf
@@ -39,9 +49,23 @@ while read build_id ; do
 	echo ${filename#$PERF_BUILDID_LINKDIR} >> $MANIFEST
 done
 
-tar cjf $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST
-rm $MANIFEST $BUILDIDS || true
-echo -e "Now please run:\n"
-echo -e "$ tar xvf $PERF_DATA.tar.bz2 -C ~/.debug\n"
-echo "wherever you need to run 'perf report' on."
+if [ $ALL -eq 1 ]; then						# pack perf.data file together with tar containing debug symbols
+	HOSTNAME=$(hostname)
+	DATE=$(date '+%Y%m%d-%H%M%S')
+	tar cjf $PERF_SYMBOLS.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST
+	tar cjf	$PERF_ALL-$HOSTNAME-$DATE.tar.bz2 $PERF_DATA $PERF_SYMBOLS.tar.bz2
+	rm $PERF_SYMBOLS.tar.bz2 $MANIFEST $BUILDIDS || true
+
+	echo -e "Now please run:\n"
+	echo -e "$ tar xvf $PERF_ALL-$HOSTNAME-$DATE.tar.bz2 && tar xvf $PERF_SYMBOLS.tar.bz2 -C ~/.debug\n"
+	echo "wherever you need to run 'perf report' on."
+else										# pack only the debug symbols
+	tar cjf $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST
+	rm $MANIFEST $BUILDIDS || true
+
+	echo -e "Now please run:\n"
+	echo -e "$ tar xvf $PERF_DATA.tar.bz2 -C ~/.debug\n"
+	echo "wherever you need to run 'perf report' on."
+fi
+
 exit 0
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-20 13:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-12 16:59 [PATCH 1/2] perf archive: Add new option '--all' vmolnaro
2023-12-12 16:59 ` [PATCH 2/2] perf archive: Add new option '--unpack' vmolnaro
2023-12-12 18:06 ` [PATCH 1/2] perf archive: Add new option '--all' Arnaldo Carvalho de Melo
2023-12-20 13:59   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).