fprof doubts

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

fprof doubts

Geevarghese Philip
Hi,

I used fprof to profile my code. I got an analysis report, but I am confused about a couple of things in the report:

   a) There is not much information about /my/ functions in the report : it is mostly about the underlying Erlang library functions. While I expect that most of the work is done by the libraries, my own functions are the gateways (so to speak) to these library functions, so they should appear in the profile with large ACC numbers against them, but this doesn't happen. Wherever my functions appear, they have very small numbers against them, and only in /two/ places do they occur with a % against them -- which indicates that the information is about calls to these functions.

b) I checked every instance in the report where the module name is "graphs" (my module). Everywhere the function reported is a fun. Why isn't the parent function reported at all?

c) In nearly every block of information, there is an entry named "undefined" with large numbers against it. What does this mean?
Could these be because I have not invoked/named my functions in some specified manner?

Thanks,
Philip

_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: fprof doubts

Raimo Niskanen-2
On Wed, Sep 03, 2008 at 01:55:31PM +0530, Geevarghese Philip wrote:

> Hi,
>
> I used fprof to profile my code. I got an analysis report, but I am confused
> about a couple of things in the report:
>
>    a) There is not much information about /my/ functions in the report : it
> is mostly about the underlying Erlang library functions. While I expect that
> most of the work is done by the libraries, my own functions are the gateways
> (so to speak) to these library functions, so they should appear in the
> profile with large ACC numbers against them, but this doesn't happen.
> Wherever my functions appear, they have very small numbers against them, and
> only in /two/ places do they occur with a % against them -- which indicates
> that the information is about calls to these functions.
>
> b) I checked every instance in the report where the module name is "graphs"
> (my module). Everywhere the function reported is a fun. Why isn't the parent
> function reported at all?
>
> c) In nearly every block of information, there is an entry named "undefined"
> with large numbers against it. What does this mean?

Can you give an example?
'undefined' is an unknown or undefined function.
E.g when you spawn a new process the caller of the
first function is 'undefined'.

> Could these be because I have not invoked/named my functions in some
> specified manner?

Yes, probably. How _did_ you trace?

        fprof:apply(graph, func, [arg])
or
        fprof:trace(start),
        graph:func(arg),
        fprof:trace(stop),
or
        fprof:trace(start),
        %wait a while
        fprof:trace(stop),
on a running system hoping to catch something interesting,

or?

>
> Thanks,
> Philip

> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://www.erlang.org/mailman/listinfo/erlang-questions

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB
_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: fprof doubts

Geevarghese Philip


On 9/3/08, Raimo Niskanen <[hidden email]> wrote:

> c) In nearly every block of information, there is an entry named "undefined"
> with large numbers against it. What does this mean?


Can you give an example?

Here is one:

{[{undefined, 156757, 7629.458, 997.459},
{{digraph,out_neighbours,2}, 63, 0.000, 0.368}],
{ {digraph,out_neighbours,2}, 156820, 7629.458, 997.827}, %
[{{digraph,collect_elems,3}, 156820, 5907.714, 471.786},
{{ets,lookup,2}, 156820, 660.148, 660.148},
{garbage_collect, 85, 58.944, 58.944},
{suspend, 353, 4.233, 0.000},
{{digraph,in_neighbours,2}, 8, 0.343, 0.044},
{{lists,dropwhile,2}, 3, 0.218, 0.010},
{{lists,filter,2}, 1, 0.031, 0.006},
{{digraph,out_neighbours,2}, 63, 0.000, 0.368}]}.

Every module listed above is from the Erlang distribution.

> Could these be because I have not invoked/named my functions in some
> specified manner?

Yes, probably. How _did_ you trace?

At the erl prompt :

> fprof:apply(graphs_test, test_run, [300, 3, 1, false], [file]).
 
> fprof:profile([file, {dump, []}]).

> fprof:analyse([{dest, []}, totals]).

 
Now look at the file "fprof.analysis" .


Thanks,
Philip

_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: : fprof doubts

Raimo Niskanen-2
On Wed, Sep 03, 2008 at 03:45:26PM +0530, Geevarghese Philip wrote:

> On 9/3/08, Raimo Niskanen
> <[hidden email]<raimo%[hidden email]>>
> wrote:
> >
> >
> > > c) In nearly every block of information, there is an entry named
> > "undefined"
> > > with large numbers against it. What does this mean?
> >
> >
> > Can you give an example?
>
>
> Here is one:
>
> {[{undefined, 156757, 7629.458, 997.459},
> {{digraph,out_neighbours,2}, 63, 0.000, 0.368}],
> { {digraph,out_neighbours,2}, 156820, 7629.458, 997.827}, %
> [{{digraph,collect_elems,3}, 156820, 5907.714, 471.786},
> {{ets,lookup,2}, 156820, 660.148, 660.148},
> {garbage_collect, 85, 58.944, 58.944},
> {suspend, 353, 4.233, 0.000},
> {{digraph,in_neighbours,2}, 8, 0.343, 0.044},
> {{lists,dropwhile,2}, 3, 0.218, 0.010},
> {{lists,filter,2}, 1, 0.031, 0.006},
> {{digraph,out_neighbours,2}, 63, 0.000, 0.368}]}.
>

I see digraph:out_neighbours/2 calls itself and this is
a typical case where Fprof might get confused since
it can get a hard time figuring out which calls are
tail recursive. Heuristics are used and
sometimes it fails.

> Every module listed above is from the Erlang distribution.
>
> > Could these be because I have not invoked/named my functions in some
> > > specified manner?
> >
> > Yes, probably. How _did_ you trace?
>
>
> At the erl prompt :
>
> > fprof:apply(graphs_test, test_run, [300, 3, 1, false], [file]).
>
> > fprof:profile([file, {dump, []}]).
>
> > fprof:analyse([{dest, []}, totals]).
>
>
> Now look at the file "fprof.analysis" .

Can you mail the "fprof.dump" and "fprof.analysis" files
to me, if they are smaller than a Megabyte, or place them
on a web server somewhere and send me the links?

The graphs_test:test_run/4 function should be in the
analysis file.

>
>
> Thanks,
> Philip

> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://www.erlang.org/mailman/listinfo/erlang-questions

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB
_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: : : fprof doubts

Raimo Niskanen-2
On Wed, Sep 03, 2008 at 02:34:47PM +0200, Raimo Niskanen wrote:

> On Wed, Sep 03, 2008 at 03:45:26PM +0530, Geevarghese Philip wrote:
> > On 9/3/08, Raimo Niskanen
> > <[hidden email]<raimo%[hidden email]>>
> > wrote:
> > >
> > >
> > > > c) In nearly every block of information, there is an entry named
> > > "undefined"
> > > > with large numbers against it. What does this mean?
> > >
> > >
> > > Can you give an example?
> >
> >
> > Here is one:
> >
> > {[{undefined, 156757, 7629.458, 997.459},
> > {{digraph,out_neighbours,2}, 63, 0.000, 0.368}],
> > { {digraph,out_neighbours,2}, 156820, 7629.458, 997.827}, %
> > [{{digraph,collect_elems,3}, 156820, 5907.714, 471.786},
> > {{ets,lookup,2}, 156820, 660.148, 660.148},
> > {garbage_collect, 85, 58.944, 58.944},
> > {suspend, 353, 4.233, 0.000},
> > {{digraph,in_neighbours,2}, 8, 0.343, 0.044},
> > {{lists,dropwhile,2}, 3, 0.218, 0.010},
> > {{lists,filter,2}, 1, 0.031, 0.006},
> > {{digraph,out_neighbours,2}, 63, 0.000, 0.368}]}.
> >
>
> I see digraph:out_neighbours/2 calls itself and this is
> a typical case where Fprof might get confused since
> it can get a hard time figuring out which calls are
> tail recursive. Heuristics are used and
> sometimes it fails.
>
> > Every module listed above is from the Erlang distribution.
> >
> > > Could these be because I have not invoked/named my functions in some
> > > > specified manner?
> > >
> > > Yes, probably. How _did_ you trace?
> >
> >
> > At the erl prompt :
> >
> > > fprof:apply(graphs_test, test_run, [300, 3, 1, false], [file]).
> >
> > > fprof:profile([file, {dump, []}]).
> >
> > > fprof:analyse([{dest, []}, totals]).
> >
> >
> > Now look at the file "fprof.analysis" .
>

For the record. The OP (Original Poster) had Hipe compiled
the module, and breakpoints can not be set on Hipe compiled
code, hence it can not be traced, and therefore it does
not show up in fprof, well shows up as 'undfined'. Alas.


--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB
_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: : : fprof doubts

Richard Carlsson-2
Raimo Niskanen wrote:
> For the record. The OP (Original Poster) had Hipe compiled
> the module, and breakpoints can not be set on Hipe compiled
> code, hence it can not be traced, and therefore it does
> not show up in fprof, well shows up as 'undfined'. Alas.

Would it be possible to make the system report it as 'native'
at least, instead of just 'undefined'?

     /Richard


--
  "Having users is like optimization: the wise course is to delay it."
    -- Paul Graham
_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions