From: José Fonseca Date: Tue, 10 May 2011 19:37:27 +0000 (+0100) Subject: Add script to recompress traces. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=738920c1dd8bbf4ab7fd68777c00f8936aa4f1c7;p=apitrace Add script to recompress traces. --- diff --git a/scripts/tracerepack.sh b/scripts/tracerepack.sh new file mode 100755 index 0000000..9152b5d --- /dev/null +++ b/scripts/tracerepack.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# Script to recompress the traces + +set -e + +for TRACE +do + gzip -l "$TRACE" | sed -n '2p' | while read COMPRESSED UNCOMPRESSED RATIO FILENAME + do + gzip -dc "$TRACE" | pv -s "$UNCOMPRESSED" | gzip --best --no-name > "$TRACE.pack" + done + COMPRESSED=`stat -c %s "$TRACE"` + RECOMPRESSED=`stat -c %s "$TRACE.pack"` + echo "$COMPRESSED -> $RECOMPRESSED" + if [ "$RECOMPRESSED" -lt "$COMPRESSED" ] + then + touch -r "$TRACE" "$TRACE.pack" + mv "$TRACE.pack" "$TRACE" + else + rm "$TRACE.pack" + fi +done