1b8e80941Smrg#!/usr/bin/env bash
2848b8605Smrg##########################################################################
3848b8605Smrg#
4848b8605Smrg# Copyright 2011 Jose Fonseca
5848b8605Smrg# All Rights Reserved.
6848b8605Smrg#
7848b8605Smrg# Permission is hereby granted, free of charge, to any person obtaining a copy
8848b8605Smrg# of this software and associated documentation files (the "Software"), to deal
9848b8605Smrg# in the Software without restriction, including without limitation the rights
10848b8605Smrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11848b8605Smrg# copies of the Software, and to permit persons to whom the Software is
12848b8605Smrg# furnished to do so, subject to the following conditions:
13848b8605Smrg#
14848b8605Smrg# The above copyright notice and this permission notice shall be included in
15848b8605Smrg# all copies or substantial portions of the Software.
16848b8605Smrg#
17848b8605Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18848b8605Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19848b8605Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20848b8605Smrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21848b8605Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22848b8605Smrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23848b8605Smrg# THE SOFTWARE.
24848b8605Smrg#
25848b8605Smrg##########################################################################/
26848b8605Smrg
27848b8605Smrgset -e
28848b8605Smrg
29848b8605SmrgTRACEDUMP=${TRACEDUMP:-`dirname "$0"`/dump.py}
30848b8605Smrg
31848b8605Smrgstripdump () {
32848b8605Smrg	python $TRACEDUMP "$1" \
33848b8605Smrg	| sed \
34848b8605Smrg		-e 's@ // time .*@@' \
35848b8605Smrg		-e 's/\x1b\[[0-9]\{1,2\}\(;[0-9]\{1,2\}\)\{0,2\}m//g' \
36848b8605Smrg		-e '/pipe_screen::is_format_supported/d' \
37848b8605Smrg		-e '/pipe_screen::get_\(shader_\)\?paramf\?/d' \
38848b8605Smrg		-e 's/\r$//g' \
39848b8605Smrg		-e 's/^[0-9]\+ //' \
40848b8605Smrg		-e 's/pipe = \w\+/pipe/g' \
41848b8605Smrg		-e 's/screen = \w\+/screen/g' \
42848b8605Smrg		-e 's/, /,\n\t/g' \
43848b8605Smrg	-e 's/) = /)\n\t= /' \
44848b8605Smrg	> "$2"
45848b8605Smrg	echo \
46848b8605Smrg		-e 's/\<0x[0-9a-fA-F]\+\>/xxx/g' \
47848b8605Smrg	> /dev/null
48848b8605Smrg}
49848b8605Smrg
50848b8605SmrgFIFODIR=`mktemp -d`
51848b8605SmrgFIFO1="$FIFODIR/1"
52848b8605SmrgFIFO2="$FIFODIR/2"
53848b8605Smrg
54848b8605Smrgmkfifo "$FIFO1"
55848b8605Smrgmkfifo "$FIFO2"
56848b8605Smrg
57848b8605Smrgstripdump "$1" "$FIFO1" &
58848b8605Smrgstripdump "$2" "$FIFO2" &
59848b8605Smrg
60848b8605Smrgsdiff \
61848b8605Smrg	--width=`tput cols` \
62848b8605Smrg	--speed-large-files \
63848b8605Smrg	"$FIFO1" "$FIFO2" \
64848b8605Smrg| less
65848b8605Smrg
66848b8605Smrgrm -rf "$FIFODIR"
67