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.
You can compile with
g++ -pg(or-pmaybe or even--coverage; and-Wallis always helpful), then usegprof(or evengcov). And you could learn to useoprofile; read more about GCC debugging options