I am looking for a profiler to get the time spent at each function in c++
code in Xcode
, I have tried Valgrind
, but I had problems with configuration because of MacOS
version is 10.12.3
and it seems that it is not supported, I have Xcode
version 8.2.1 (8C1002)
.
any help is greatly appreciated!
Asked
Active
Viewed 560 times
0

arunjos007
- 4,105
- 1
- 28
- 43

user3406305
- 7
- 2
-
What do you mean "in"? If somebody writes `printf("Hello World\n");` and the program does nothing else, running it takes a certain amount of time, like maybe 10ms. Is it "in" that program during that time? – Mike Dunlavey Mar 30 '17 at 13:06
-
well, yes, i would like to find out this 10 ms in a profiler that works for Xcode, without using (double)clock() / CLOCKS_PER_SEC; – user3406305 Mar 30 '17 at 15:23
-
Then what you want is "inclusive" time. On a processor that runs at 1ghz, that's 10 million cycles, almost none of which are spent in that routine. You also want "wall clock" time, not "CPU time", because most of those 10^7 cycles are spent waiting for another process, or another process**or**, to actually do the I/O. [*Here*](http://stackoverflow.com/a/378024/23771) is the method I and others use, when the point is not to get measurements but to find out what costs the most. – Mike Dunlavey Mar 30 '17 at 19:30