profiling with g++
g++, profile
Solution
You can compile with `g++ -pg` (or `-p` maybe or even `--coverage`; and `-Wall` is always helpful), then use `gprof` (or even `gcov`). And you could learn to use `oprofile`; read more about GCC debugging options
Problem
How to profile c++ code to get the call times and cost time of each line of the code, just as the profile tool in Matlab does? I tried to use things like -fprofile-arcs, but it only generates a code coverage report, in which call times can be found, but cost time cannot. Can anybody help out? Regards.