Difference between revisions of "Outwatch sorter"
From MohidWiki
Line 6: | Line 6: | ||
==Code== | ==Code== | ||
+ | ===Outwatch_sortall.bat=== | ||
+ | <htm> | ||
+ | <pre name="code" class="batch"> | ||
+ | @echo off | ||
+ | |||
+ | REM Every Outwatch* file gets sorted and stored under the filename Sorted_Outwatch*. | ||
+ | for /F %%i in ('dir /B Outwatch*.txt') do @Outwatch_sorter.bat %%i > Sorted_%%~ni.txt | ||
+ | |||
+ | @echo on | ||
+ | </pre> | ||
+ | </htm> | ||
+ | |||
+ | ===Outwatch_sorter.bat=== | ||
<htm> | <htm> | ||
<pre name="code" class="batch"> | <pre name="code" class="batch"> |
Latest 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
Outwatch_sortall.bat
@echo off REM Every Outwatch* file gets sorted and stored under the filename Sorted_Outwatch*. for /F %%i in ('dir /B Outwatch*.txt') do @Outwatch_sorter.bat %%i > Sorted_%%~ni.txt @echo on
Outwatch_sorter.bat
@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