Skip to content

Instantly share code, notes, and snippets.

@AdamBrouwersHarries
Created July 5, 2017 15:48
Show Gist options
  • Save AdamBrouwersHarries/b6e4df8d3f112f063ecb3deccf2fde9e to your computer and use it in GitHub Desktop.
Save AdamBrouwersHarries/b6e4df8d3f112f063ecb3deccf2fde9e to your computer and use it in GitHub Desktop.
Analysis tool for profiling information
#!/bin/sh
resultfile=$1
profilefile=$(echo $resultfile | sed -e "s/result/profiling_data/g")
summaryfile=$(echo $resultfile | sed -e "s/result/profile_summary/g")
readablesummary=$(echo $resultfile | sed -e "s/result/profile_summary_readable/g")
touch $profilefile
cat $resultfile | grep "PROFILING_DATUM" > $profilefile
echo "Found profiling data"
sed -i -e "s/\[====.*\] //g" -e "/^PROFILING_DATUM/!d" -e "s/PROFILING_DATUM: (//g" -e "s/)//g" -e "s/ //g" $profilefile
echo "Preprocessed"
q -O -d , "select c1 as method, c2 as context, c4 as language, count(c3) as calls, min(c3) as minimum, avg(c3) as mean, max(c3) as maximum, sum(c3) as total from $profilefile group by c1, c2, c4 order by total desc" > $summaryfile
cat $summaryfile | column -t -s ,
cat $summaryfile | column -t -s , > $readablesummary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment