Best way to find out a progrm's flow

hercules

Disciple
Hello friends,
I would like to know, what according to you, is the best way to start knowing a given code (ofcourse it may contain a 100 files) . Basically I would like to know what can be an efficient way to know the flow of a code (c++ on linux) , one way is to give print statements in all the functions and run the code and see the order of prints :D . But is there any tool or any other better way of finding out the code's flow ?
 
A debugger? That is good for a simple program, though perhaps not so much for complicated ones (unless you have some idea what you are targeting). You can try profiling tools like gprof and vtune. Vtune is now free for non-commercial use (academic use is NOT considered non-commercial).
 
KingKrool said:
A debugger? That is good for a simple program, though perhaps not so much for complicated ones (unless you have some idea what you are targeting).
Why not ?

i've used them in complex environments, you only care how your code works, and not too much about what happens in the libraries.

i missed the obivious, READ THE CODE :D

KingKrool said:
You can try profiling tools like gprof and vtune. Vtune is now free for non-commercial use (academic use is NOT considered non-commercial).
Don't understand the reason you recommend a profiler to find out about program flow, if it was bottlenecks then sure but the general flow..hmm :S
 
yes, I think a graphical flow was exactly what i was looking for :) . read the code! I WILL :D but after reading the code , making a graphical flow is exactly what i want to do. So If there is already a tool for that, i can use it. But i haven't found a free one yet.. :huh:
 
When I said "a debugger?" your comment wasn't even up... so I was really pointing out the use of a debugger to the thread originator, not countering your point.

As for profilers, well VTune has a call graph mode in which it is able to create a call hierarchy graph... who call whom. That is control flow if there ever was any.

Vtune is available free. I downloaded it some days ago. Look for it a bit harder. Remember, google helps those who help themselves.
 
KingKrool said:
As for profilers, well VTune has a call graph mode in which it is able to create a call hierarchy graph... who call whom. That is control flow if there ever was any.
That sounds exactly like what he's asking for.
 
Back
Top