12 December 2009

Contributing to laptop mode tools

As confirmed by laptop mode tools' changelog, my patch is finally merged into their core code. I simply contribute few line to show statistics regarding write and read frequency of every programs recorded during lm-profiler's runtime.

So, how the code looks like?

—- lm-profiler.old2009-06-03 21:12:52.000000000 +0700

+++ lm-profiler2009-06-26 21:08:54.000000000 +0700

@ -209,6 +209,11 @


done
printf ’\r \r’
stop_profiling

+

+echo “Write frequency : ”; cat $WORKDIR/write_accesses_* | sed -e ’s/[ \t]*//;s/[ \t]*$//’ -e ’/$/ d’ | sort | uniq -c | sort -n

+echo “Read frequency : ”; cat $WORKDIR/read_accesses_* | sed -e ’s/[ \t]*//;s/[ \t]*$//’ -e ’/$/ d’ | sort | uniq -c | sort -n

+echo;

+
NETPROFILE=`profilenet`
echo “Profiling run completed.”

Looks awful? I admit it. In short, it grabs files created by lm-profiler during its run time, trims out the blanks and then sort them, while at the same time showing their frequencies ascendingly.

NB: Actually it's for my own reminder, but to share with you all. To easily convert text to HTML (and dealing with all those escape characters etc), you could use http://www.textism.com/tools/textile/index.php. Simply paste your text there and click the button, voila..you get the HTML-ized text!

regards,

Mulyadi

1 comment:

Iwan BK said...

Wah, tetep semangat ngoprek kernel :D.
Saya dah lama ga ngoprek

How to execute multiple commands directly as ssh argument?

 Perhaps sometimes you need to do this: ssh user@10.1.2.3 ls It is easy understand the above: run ls after getting into 10.1.2.3 via ssh. Pi...