views:

67

answers:

1

Is it possible to generate a tree of function calls at runtime? I'd like to get a feel of what the program is calling.

This is essentially the same as breaking at a particular location, stepping through each function, and recording down what the function names are. I have no performance constraints.

I am using Visual Studio, but do not have to.

// edit

To clarify, if I had function A calling function B and function C, and function B calls function D, I'd like the following example output:

(0.01s) -> Function A
(0.02s)   -> Function B
(0.02s)       -> Function D
(0.03s)    -> Function C

I do not want a static call graph. I want what happens on the stack for each function call at runtime.

+1  A: 

You can probably make it happen with all sorts of different approaches, but I think your best bet is to just use a profiler.

Figuring out "who calls what how often" is exactly what that tool is for.

Mike G.
I don't want a tool that shows how often something is called. I want a tool that shows exactly the order of executed functions at runtime that is called at runtime.
MTsoul