Skip to content

Instantly share code, notes, and snippets.

@yyyyyyuanfei
Created May 30, 2012 11:50
Show Gist options
  • Select an option

  • Save yyyyyyuanfei/2835773 to your computer and use it in GitHub Desktop.

Select an option

Save yyyyyyuanfei/2835773 to your computer and use it in GitHub Desktop.
#!/usr/bin/awk -f
BEGIN {
g_max = -1;
g_min = 999999999;
}
{
match($0, /[0-9]*\ \"-\"/);
timeInterval = substr($0, RSTART, RLENGTH - 4) / 1e6;
g_count += timeInterval;
g_max = (g_max > timeInterval ? g_max : timeInterval);
g_min = (g_min < timeInterval ? g_min : timeInterval);
}
END {
printf("Total: \t%10.ds\nAvg:\t%10.fs\nMax:\t%10.ds\nMin:\t%10.2fs\n",
g_count, g_count / NR, g_max, g_min)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment