Re: "Subtracting" runs?

Michael Petlan <[email protected]> Mon, 7 Jan 2019 10:50:58 +0100 (CET)
Newsgroups gmane.linux.oprofile
Message-ID <alpine.LRH.2.20.1901071046260.9862@Diego>
On Wed, 26 Dec 2018, Nikolaus Rath wrote:
> On Dec 10 2018, John Levon <[email protected]> wrote:
> > On Fri, Dec 07, 2018 at 02:19:24PM +0000, Nikolaus Rath wrote:
> >
> >> Is there a way to "subtract" two oprofile runs from each other?
> >> Basically, I have a process that takes much longer when run with a
> >> specific parameter, and I would like to find out where the extra time is
> >> spent.
> >
> > http://oprofile.sourceforge.net/doc/opreport.html#opreport-diff
> 
> Thanks! I have trouble getting it to work though. Following the
> instructions verbatim, I get:
> 
> (I am not concerned about the lost samples at this point)
> 
> ,----
> | $ operf tests/readall /lib 
> | operf: Profiler started
> | Read 621.19 MB from 8370 files.
> | * * * * WARNING: Profiling rate was throttled back by the kernel * * * *
> | The number of samples actually recorded is less than expected, but is
> | probably still statistically valid.  Decreasing the sampling rate is the
> | best option if you want to avoid throttling.
> | 
> | WARNING: Lost samples detected! See /home/nikratio/build/oprofile_data/samples/operf.log for details.
> | Lowering the sampling rate may reduce or eliminate lost samples.
> | See the '--events' option description in the operf man page for help.
> | 
> | Profiling done.
> | 
> | $ oparchive -o orig tests/readall 
> | Using /home/nikratio/build/oprofile_data/samples/ for session-dir
> | 
> | WARNING! Some of the events were throttled. Throttling occurs when
> | the initial sample rate is too high, causing an excessive number of
> | interrupts.  Decrease the sampling frequency. Check the directory
> | /home/nikratio/build/oprofile_data/samples/current/stats/throttled
> | for the throttled event names.
> | 
> | 
> | WARNING: Lost samples detected! See /home/nikratio/build/oprofile_data/samples/operf.log for details.
> | NOTE: The sample data in this archive is located at /home/nikratio/build/oprofile_data
> | and is being moved to the standard location of /var/lib/oprofile/.
> | warning: /ext4 could not be found.
> | warning: /fscrypto could not be found.
> | 
> | $ operf tests/readall /lib --sleep
> | operf: Profiler started
> | Read 621.19 MB from 8370 files.
> | 
> | WARNING: Lost samples detected! See /home/nikratio/build/oprofile_data/samples/operf.log for details.
> | Lowering the sampling rate may reduce or eliminate lost samples.
> | See the '--events' option description in the operf man page for help.
> | 
> | Profiling done.
> | 
> | $ opreport --session-dir=`pwd`/oprofile_data/ tests/readall -l { archive:./orig } { }
> | opreport error: No sample found: Please specify a session containing 
> | sample data.
> `----
> 
> What am I doing wrong? Note that I did not recompile but use a different
> flag, but I hope that's not the problem.
> 
> 
> I also tried moving around data in oprofile_data/samples manually,
> (because I was a little annoyed by the size of the archive created by
> oparchive). I got that to produce output, but for some reason the binary
> used in each run did not get matched up correctly (i.e., I would
> consistently get +100% and -100% diffs on both sides).

Hi.

$ operf ./cache_stressing 2048
[...]
$ oparchive -o run1
Using /home/Michael/prg/c/test/oprofile_data/samples/ for session-dir
NOTE: The sample data in this archive is located at /home/Michael/prg/c/test/oprofile_data
and is being moved to the standard location of /var/lib/oprofile/.
warning: /no-vmlinux could not be found.
$ operf ./cache_stressing 16385
[...]
$ oparchive -o run2
Using /home/Michael/prg/c/test/oprofile_data/samples/ for session-dir
NOTE: The sample data in this archive is located at /home/Michael/prg/c/test/oprofile_data
and is being moved to the standard location of /var/lib/oprofile/.
warning: /no-vmlinux could not be found.
[Michael@Diego test]$ opreport --merge=all -a -l --demangle=smart { archive:run1 } { archive:run2 } 
Using /var/lib/oprofile//samples/ for samples directory.
Using /var/lib/oprofile//samples/ for samples directory.
warning: /home/Michael/prg/c/test/run1/no-vmlinux could not be found.
CPU: Intel Skylake microarchitecture, speed 3.4e+06 MHz (estimated)
Counted cpu_clk_unhalted events () with a unit mask of 0x00 (Core cycles when at least one thread on the physical core is not in halt state) count 100000
warning: /home/Michael/prg/c/test/run2/no-vmlinux could not be found.
samples  cum. samples  %        cum. %     diff %    app name                 symbol name
2993     2993          88.8131  88.8131    +15.9131  no-vmlinux               /no-vmlinux
359      3352          10.6528  99.4659    -49.1490  cache_stressing          main
7        3359           0.2077  99.6736    -77.5668  libc-2.17.so             random
7        3366           0.2077  99.8813    -77.5668  libc-2.17.so             random_r
2        ---           ---      ---        ---       libc-2.17.so             rand
1        3367           0.0297  99.9110    -74.3620  ld-2.17.so               _dl_relocate_object
1        3368           0.0297  99.9407    +++       ld-2.17.so               mmap
1        3369           0.0297  99.9703    -74.3620  libc-2.17.so             _dl_addr
1        3370           0.0297  100.000    +++       libc-2.17.so             strcasecmp
1        ---           ---      ---        ---       libc-2.17.so             vfprintf

Is this what you want to achieve?

In case you have -100% and +100% vaules, you probably don't have enough
samples, so they are spread differently, thus opreport can't match them
properly... Just what comes into my mind...

Cheers,
Michael

> 
> 
> Thanks!
> -Nikolaus
> 
> 
> -- 
> GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F
> 
>              »Time flies like an arrow, fruit flies like a Banana.«
> 
> 
> _______________________________________________
> oprofile-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oprofile-list
>

_______________________________________________
oprofile-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oprofile-list