I'm trying to profile a group of mutually recursive functions. Preferably I'd like to see for each function how much time it takes relative to the other functions. However due to these functions being mutually recursive, regular profiling shows all functions taking up 100% time.
What I'd like my profiling to do is show the inclusive time of each function, without including the time it spends on the recursive calls. So for example A calls both B and C; B calls A again; and C doesn't call anything. For A I'd like to see the % of times when either A is on top of the call stack, or A;C (with C being the top), but not A;B. I guess the profiling should never look beyond any of the mutually recursive functions when looking at the call stack, so call stack XAZ (bottom to top) becomes AZ and XAZB becomes just B.
I guess one solution would be to write each function into a tail recursive form, then put everything except the tail-call into a separate non-recursive function. However this would be a big rewrite and would also effect the performance characteristics of the program, so it's far from ideal.
Ideally there would be a profiler with configuration options to help me out. I'm working in C#. Is there one? Otherwise do you think it might be possible to hack the profile session files to get what I want?
Thanks in advance!