#!/bin/bash
#$1 is systrace file;
#set -x
grep -A 80 "entries-in-buffer/entries-written" "$1"
echo -n "\033[31m 從上邊trace log中查找和systrace 0點相對應的時間戳並輸入: \033[0m"
read ts0
echo "please wait for a few minutes ....."
awk -v timezero=$ts0 -F "timescope" '{gsub(/[0-9]*[.][0-9][0-9][0-9][0-9][0-9][0-9][:]/,"timescope×cope");if($0~/\[00[0-7]\]/) printf("%6f ", $2-timezero);gsub(/timescope/,"",$0);if($0~/\[00[0-7]\]/) print $0}' $1 > $1.timestamp