File: valgrind_compare

package info (click to toggle)
asterisk 1%3A1.8.13.1~dfsg1-3%2Bdeb7u3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 49,336 kB
  • sloc: ansic: 497,975; sh: 11,763; cpp: 5,934; makefile: 3,065; perl: 3,019; yacc: 2,147; xml: 498; sql: 387; tcl: 113; php: 62; python: 42
file content (21 lines) | stat: -rwxr-xr-x 525 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

# compare_valgrind: diff two valgrinf memory usage logs. Masks out PIDs,
# addresses and such that should normally be different.
#
# Usage: ./compare_valgrind file1.log file2.log | less
#
# (Requires /bin/bash due to usage of '<()' )

log1="$1"
log2="$2"

pipe_log() {
	sed \
		-e 's/^--[0-9]\+-- //' -e 's/^==[0-9]\+== //' "$1" \
		-e 's/ record [0-9]\+ of [0-9]\+$/ <snipped>/' \
		-e 's/^ Address 0x[0-9a-f]\+/ Address 0x<snipped>/' \

}

diff -u -L "$log1" <(pipe_log "$log1") -L "$log2" <(pipe_log "$log2")