Created
January 7, 2010 06:08
-
-
Save videlalvaro/271034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
# run inside a symfony project: | |
# ./extractinfo.sh log/frontend_dev.log 'execute(Query|Update|Insert)' | sort -n | |
# will return the number of queries per request | |
# in symfony 1.2+ you can try something like: | |
# ./extractinfo.sh log/frontend_dev.log 'sfPropelLogger' | |
# you can modify the second parameter to extract the required information and also point | |
# the script to a different symfony log file | |
# the output will be how many matches of the second parameter occurred inside each symfony request | |
awk -v info="$2" ' | |
/(M|m)atch route/ { | |
requests++; | |
route = $9; | |
} | |
$0 ~ info { | |
result[requests SUBSEP route]++; | |
} | |
END { | |
print info | |
for(combined in result){ | |
split(combined, separate, SUBSEP); | |
printf("%d %s\n", result[combined], separate[2]); | |
} | |
} | |
' $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment