strace-log-merge: work around corner cases of strace -ttt parsing
Employing strace -ttt for the logs destined to be fed to strace-log-merge is ultimately the best solution except for the logs that pass the following dates: Thu Jan 1 00:00:09 UTC 1970 Thu Jan 1 00:01:39 UTC 1970 Thu Jan 1 00:16:39 UTC 1970 Thu Jan 1 02:46:39 UTC 1970 Fri Jan 2 03:46:39 UTC 1970 Mon Jan 12 13:46:39 UTC 1970 Sun Apr 26 17:46:39 UTC 1970 Sat Mar 3 09:46:39 UTC 1973 Sun Sep 9 01:46:39 UTC 2001 Sat Nov 20 17:46:39 UTC 2286 Wed Nov 16 09:46:39 UTC 5138 Fri Sep 27 01:46:39 UTC 33658 Sun May 20 17:46:39 UTC 318857 Sat Nov 7 09:46:39 UTC 3170843 Sun Jul 5 01:46:39 UTC 31690708 Sat Jan 25 17:46:39 UTC 316889355 Let's lift this limitation. * strace-log-merge: Generate numeric-only key for sorting, use sort -n option.
This commit is contained in:
parent
b0c8e3bc4d
commit
b053dd53ed
@ -40,6 +40,9 @@ option which prints timestamps (otherwise sorting won't do any good).
|
||||
__EOF__
|
||||
}
|
||||
|
||||
dd='\([0-9][0-9]\)'
|
||||
ds='\([0-9][0-9]*\)'
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
show_usage >&2
|
||||
exit 1
|
||||
@ -59,10 +62,10 @@ for file in "$logfile".*; do
|
||||
# Some strace logs have last line which is not '\n' terminated,
|
||||
# so add extra newline to every file.
|
||||
# grep -v '^$' removes empty lines which may result.
|
||||
sed "s/^/$pid /" < "$file"
|
||||
sed -n "s/^\($dd:\)\?\($dd:\)\?\($ds\.\)\?$ds /\2\4\6\7 $pid \0/p" < "$file"
|
||||
echo
|
||||
done \
|
||||
| sort -s -k2,2 | grep -v '^$'
|
||||
| sort -s -n -k1,1 | sed -n 's/^[0-9][0-9]* //p'
|
||||
|
||||
rc=$?
|
||||
[ $rc -eq 1 ] &&
|
||||
|
Loading…
Reference in New Issue
Block a user