Difference between revisions of "Outwatch sorter"
From MohidWiki
(New page: Batch file utility that sorts Outwatches logs by decreasing order of Module cpu-elapsed time. ==Code== @echo off SET FIL=%1 REM Get an unsorted list of modules stacked in the log. ca...) |
|||
| Line 2: | Line 2: | ||
==Code== | ==Code== | ||
| + | <htm> | ||
| + | <pre name="code" class="batch"> | ||
@echo off | @echo off | ||
SET FIL=%1 | SET FIL=%1 | ||
| Line 27: | Line 29: | ||
del modulelist.tmp | del modulelist.tmp | ||
@echo on | @echo on | ||
| + | </pre> | ||
| + | </htm> | ||
[[Category:Programming]] | [[Category:Programming]] | ||
[[Category:Linux]] | [[Category:Linux]] | ||
[[Category:Windows]] | [[Category:Windows]] | ||
Revision as of 17:41, 17 September 2010
Batch file utility that sorts Outwatches logs by decreasing order of Module cpu-elapsed time.
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