Difference between revisions of "Outwatch sorter"
From MohidWiki
Line 1: | Line 1: | ||
[[Batch]] file utility that sorts Outwatches logs by decreasing order of Module cpu-elapsed time. | [[Batch]] file utility that sorts Outwatches logs by decreasing order of Module cpu-elapsed time. | ||
+ | |||
+ | $ Outwatch_sorter.bat Outwatch_2.txt | ||
+ | |||
+ | $ Outwatch_sortall.bat | ||
==Code== | ==Code== |
Revision as of 18:07, 17 September 2010
Batch file utility that sorts Outwatches logs by decreasing order of Module cpu-elapsed time.
$ Outwatch_sorter.bat Outwatch_2.txt
$ Outwatch_sortall.bat
Code
@echo off SET FIL=%1 REM Get an unsorted list of modules stacked in the log. cat %FIL% | gawk '{print $1}' | gsort | uniq > modulelist.tmp REM Create a list of the modules highest times. for /F %%i in (modulelist.tmp) do ( cat %FIL% | grep %%i | gsort -r -k3 | head -n 1 >> besttimeslist.tmp ) REM Get a list of modules stacked in the log, sorted by decreasing highest cpu-time elapsed. cat besttimeslist.tmp | gsort -r -k3 | gawk '{print $1}' | uniq > sortedmodulelist.tmp cat sortedmodulelist.tmp echo " " REM For each module present in the log, sort by decreasing cpu-time elapsed. for /F %%i in (sortedmodulelist.tmp) do ( cat %FIL% | grep %%i | gsort -r -k3 >> moduletimes.tmp ) cat moduletimes.tmp del sortedmodulelist.tmp del besttimeslist.tmp del moduletimes.tmp del modulelist.tmp @echo on