> Date: Tue, 19 Jun 2012 09:09:49 -0500
> From: maynardj@us.ibm.com
> To: bo-liu@hotmail.com
> CC: oprofile-list@lists.sourceforge.net
> Subject: Re: [HELP]opreport error: Invalid sample file, bad magic number
>
> On 06/19/2012 04:47 AM, Liu bo wrote:
> > Hi folks,
> >
> > I always got below error using oprofile 0.9.4 with kernel version3.3.
> > ===========================
> > mkdir -p /var/lib/oprofile/samples
> > opcontrol --init
> > oprofiled -e '' --no-vmlinux --session-dir=/var/lib/oprofile --image=/usr/bin/whetstone &
> > opcontrol --start
> > whetstone
> > opcontrol --dump
> >
> > root:/> opreport -lw
> > opreport error: Invalid sample file, bad magic number: /var/lib/oprofile/samples/current/{root}/usr/bin/whetstone/{dep}/{root}/usr/bin/whetstone/TIMER.0.0.all.all.all
> This usually implies that opreport is finding samples collected from two different versions of oprofile. I suggest you wipe everything clean ('rm /root/.oprofile/daemonrc' and 'opcontrol --reset') and try again. You usually want to do 'opcontrol --reset' prior to starting any profiling session, else you'll be appending new profile data to previous profile data. By the way, I notice above that you're starting oprofiled manually. Don't do that unless there's a real good reason. The 'opcontrol --start' will automatically start oprofiled.

I am using oprofile 0.9.4.
I've try again following your suggetion like below:
root:/> mkdir -p /var/lib/oprofile/samples
root:/>
root:/> opcontrol --reset
root:/> opcontrol --init

root:/> opcontrol --start --no-vmlinux --session-dir=/var/lib/oprofile --image=/
usr/bin/whetstone &
[1] 387 opcontrol --start --no-vmlinux --session-dir=/var/lib/oprofile --image=/usr/bin/whetstone
root:/> Using 2.6+ OProfile kernel interface.
Using log file /var/lib/oprofile/samples/oprofiled.log

root:/> whetstone

Loops: 1000, Iterations: 1, Duration: 4 sec.
C Converted Double Precision Whetstones: 25.0 MIPS
root:/> opcontrol --dump
root:/>
root:/> opreport -lw
opreport error: No sample file found: try running opcontrol --dump
or specify a session containing sample files

root:/> cat /var/lib/oprofile/samples/oprofiled.log
oprofiled started Mon Jan  1 00:01:10 2007
kernel pointer size: 4
root:/>

It seems this time no sample files were generated.

But oprofile v0.9.1 works fine for me.
Thank you!

>
> -Maynard
> > root:/>
> > ============================
> >
> > Any ideas? Thank you!
>
 
 --
Best regards
-Bob Liu