valgrind_compare 525 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. # compare_valgrind: diff two valgrinf memory usage logs. Masks out PIDs,
  3. # addresses and such that should normally be different.
  4. #
  5. # Usage: ./compare_valgrind file1.log file2.log | less
  6. #
  7. # (Requires /bin/bash due to usage of '<()' )
  8. log1="$1"
  9. log2="$2"
  10. pipe_log() {
  11. sed \
  12. -e 's/^--[0-9]\+-- //' -e 's/^==[0-9]\+== //' "$1" \
  13. -e 's/ record [0-9]\+ of [0-9]\+$/ <snipped>/' \
  14. -e 's/^ Address 0x[0-9a-f]\+/ Address 0x<snipped>/' \
  15. }
  16. diff -u -L "$log1" <(pipe_log "$log1") -L "$log2" <(pipe_log "$log2")