Can I expect this to work correctly when calling out to C libraries with ccall?
robertfeldt opened this issue · 1 comments
Thanks for CPUTime, very useful in our research to get more accurate timings on single-threaded code.
I guess the questions says it all.
In my initial experiments it seems to be correct but have not used for any longer times so might be measurement errors... ;)
Yes, I believe so. The timer works by calling out to the OS for a measure of the current process resource usage (in the case of UNIX, sys/resource.h: "The getrusage() function provides measures of the resources used by the current process or its terminated and waited-for child processes."). So this should definitely work for ccall'ed code, and it may even work for stuff like MATLAB.jl which spawns a child MATLAB session, provided you close the session once you're done profiling. Of course, how to interpret results generated in this fashion would be the real question.
42872 schmrlng | `- -zsh
42897 schmrlng | `- julia
42944 schmrlng | `- /Applications/MATLAB_R2013a.app/bin/maci64/../../Contents/MacOS/MATLAB_maci64 -nosplash