|
| 1 | +#!/bin/sh |
| 2 | +# |
| 3 | +# Filter tracegrind trace output (from tracegrind-analyzer) |
| 4 | +# to normalize machine-dependent values for regression testing. |
| 5 | +# |
| 6 | + |
| 7 | +# Normalize format/schema version numbers |
| 8 | +sed 's/^Format Version: [0-9]\+$/Format Version: N/' | |
| 9 | +sed 's/^Schema Version: [0-9]\+$/Schema Version: N/' | |
| 10 | + |
| 11 | +# Normalize object paths: replace full path to test binary with just the basename |
| 12 | +# e.g. obj=/home/user/valgrind/tracegrind/tests/test_marker -> obj=test_marker |
| 13 | +sed 's|obj=[^ |]*[/]||g' | |
| 14 | + |
| 15 | +# Normalize file paths: replace full source paths with just the basename |
| 16 | +# e.g. file=/home/user/.../test_marker.c -> file=test_marker.c |
| 17 | +sed 's|file=[^ |]*[/]||g' | |
| 18 | + |
| 19 | +# Normalize function address/stats that vary: Ir counts |
| 20 | +# Replace Ir=<number> with Ir=N |
| 21 | +sed 's|Ir=[0-9]\+|Ir=N|g' | |
| 22 | + |
| 23 | +# Remove the separator line |
| 24 | +sed '/^-\{10,\}$/d' | |
| 25 | + |
| 26 | +# Normalize "Total rows:" count |
| 27 | +sed 's/^Total rows: [0-9,]\+$/Total rows: N/' | |
| 28 | + |
| 29 | +# Normalize "Showing X of Y rows" |
| 30 | +sed 's/^Showing [0-9,]\+ of [0-9,]\+ rows$/Showing N of N rows/' | |
| 31 | + |
| 32 | +# Normalize "Sequence range:" numbers |
| 33 | +sed 's/^Sequence range: [0-9,]\+ - [0-9,]\+$/Sequence range: N - N/' | |
| 34 | + |
| 35 | +# Normalize event count percentages in stats |
| 36 | +sed 's/\([0-9,]\+\) ([0-9.]\+%)/N (P%)/g' | |
| 37 | + |
| 38 | +# Normalize "Threads: N ([...])" |
| 39 | +sed 's/^Threads: \([0-9]\+\) (\[.*\])/Threads: \1/' | |
| 40 | + |
| 41 | +# Remove "Top 10 functions" section (platform-dependent) |
| 42 | +sed '/^Top 10 functions/,/^$/d' | |
| 43 | + |
| 44 | +# Remove "Fork events" section (platform-dependent) |
| 45 | +sed '/^Fork events/,/^$/d' | |
| 46 | + |
| 47 | +# Normalize seq numbers in raw arrays: [1234, ...] -> [N, ...] |
| 48 | +sed 's/^\[\([0-9]\+\),/[N,/g' | |
| 49 | + |
| 50 | +# Normalize seq=<number> in formatted output |
| 51 | +sed 's/seq=[0-9]\+/seq=N/g' | |
| 52 | + |
| 53 | +# Strip GCC optimization suffixes from function names (e.g. .constprop.0, .isra.0, .part.0) |
| 54 | +sed 's/\.\(constprop\|isra\|part\|cold\|lto_priv\)\.[0-9]*//g' |
0 commit comments