Personal tools

Outwatch sorter

From MohidWiki

Revision as of 18:40, 17 September 2010 by Guillaume (talk | contribs) (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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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