This is an incomplete summary of the steps needed to profile C++ programs using Linux's perf tool, a fantastic profiler that samples your program and sees how much time is spent on each function, together with information about who calls whom.
First of all ensure that you have
Invoke the profiler on your program, instructing it to record information about which function calls which one (the call-graph)
# perf --call-graph dwarf your-program program-arguments
Data is stored in a binary file called perf.data. You can process it in text mode with
or even better produce a graph
that you can now visualize
The output should look more or less like this (only a subset of my graph is shown)