12 Dec 2007 (Wed)

01:22:23 # Life Using opreport --xml output. oprofile is a tool that collects profiling information, and oprofile reports are output using opreport command. opreport usually gives text output which is processable by human beings, but pretty hard to process from computer program. However, recent versions of opreport does give you XML output when you give it the -X option. The output format is pretty simple, and it is trivial to write some XSLT code to process the XML output into some kind of HTML.. The XML output was obtained with the following command-line (of course, I call it 'opshell.sh' and have it as a shell script. $@ is the command to invoke, which in this case I ran 'dmesg')

sudo opcontrol --shutdown
sudo opcontrol --reset
sudo opcontrol --setup \
    --vmlinux=/lib/modules/$(uname -r)/build/vmlinux \
    --separate=library
sudo opcontrol --start
$@
sudo opcontrol --dump
sudo opcontrol --shutdown
opreport -X > XXXX.xml
	

To process the output using xsltproc, the following was required:

 xsltproc opreport-op.xsl opreport-op.xml > opreport-op.html
	
Junichi Uekawa

$Id: dancer-diary.el,v 1.92 2007/08/30 21:46:09 dancer Exp $