|
From: Josef W. <Jos...@gm...> - 2004-03-25 09:55:55
|
On Thursday 25 March 2004 09:43, Nicholas Nethercote wrote:
> On Wed, 24 Mar 2004, Josef Weidendorfer wrote:
> > You are right. It's only a matter of writing a conversion script from
> > massif data (raw/ASCII ?) to cachegrind/calltree format.
> > KCachegrind should be able to cope with multiple cachegrind/calltree
> > simple concatenated together (for multiple consensi). The format is
> > described in a HTML documentation in the calltree package.
> > Any volunteers?
>
> I'm not sure about this. With (K)Cachegrind, you have a figure for every
> instruction in the program, and these get mapped onto individual lines.
> For Massif, you don't really have a spacetime figure for every
> instruction. I think you'd only be annotating lines containing a function
> call that allocates memory, or that (eventually) calls a function that
> allocated memory? Eg, in this (nonsense) program:
Yes.
Source Annotation does not make much sense in this case.
If you have allocation contexts, you can construct some kind of call graph out
of this, and calculate inclusive costs in the conversion.
I'm not really sure if the result is worth it, but it looks easy to do.
> int* f(void)
> {
> return malloc(1000); // 11 * 1000 * t
> }
>
> int* g(void)
> {
> bar();
> for (i = 0; i < 10; i++)
> f(); // 10 * 1000 * t
Here we add: "Call to f with inclusive cost of 10 * 1000
> return f(); // 1 * 1000 * t
Here we add: "Call to f with inclusive cost of 1 * 1000
> }
>
> int* h(void)
> {
> foo();
> x = y + z;
> return g(); // 11 * 1000 * t
> }
>
>
> (where 't' is the length of time all the blocks are in existence for).
> The comments show where the annotations would go; I'm assuming h() is
> only called once.
>
> Is that right?
Yes. The numbers of the contexts would be present in inclusive costs.
I'm not sure: Would the location of the call sites be available for annotation
purpose?
On a side note:
As I managed to run OProfile on my Pentium-M notebook, I'm more interested in
a import/conversion of the sample data from OProfile.
My vision is to use call graph data from Calltree for a run of a program, and
be able to add estimations for inclusive costs to the sampling results of
OProfile for the same (deterministic) program, assuming same calls.
This would be a way to get inclusive costs for all kind of performance metrics
on all architectures where OProfile can run (AMD64, PowerPC, IA-64), with no
instrumentation, and almost no messuring overhead. Of course this assumes
that call relationship is roughly the same for the same program with
different compilers/platforms.
BTW, has somebody used OProfile to profile valgrind?
If somebody is interested, I could provide some messurements.
Josef
|