[erlang-questions] fprof.dump: what is CP?

Raimo Niskanen <>
Mon Sep 1 09:26:39 CEST 2008


On Sat, Aug 30, 2008 at 11:47:05PM +0100, Joel Reymont wrote:
> What does CP stand for in the following fprof dump?
> 
> {trace_ts,<7839.37.0>,in,
>            {fprof,apply_start_stop,4},
>            {1220,133658,589577}}
> {trace_ts,<7839.37.0>,call,
>            {mb,test,3},
>            {cp,{fprof,apply_start_stop,4}},
>            {1220,133658,589592}}
> 
> Is it Swedish for caller function or is it an abbreviation for  
> something else?

It is the Continuation Pointer, that is the return
address - where execution should contiue when a function
returns. 

When a function does a tail recursive call the CP does
not change. If the call is non-tail recursive (deep,
nested, ...), the CP is first pushed on the stack
and then set to the current (next) Program
Counter before the call, so CP changes.

It is chiefly this information Fprof uses to
deduce the true call stack from the execution trace.

> 
> 	Thanks, Joel
> 
> --
> wagerlabs.com
> 
> 
> 
> 
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list