Hello,
I am trying to setup a method for timing procedures that I have written,
to establish the rate at which my process can run. Right now I am using
CLOCK_REALTIME to get a start and stop point, such as
clock_gettime( CLOCK_REALTIME, &start );
MyCustomFunction();
clock_gettime( CLOCK_REALTIME, &stop );
Is this a reliable method for timing functions? I run into problems
sometimes when I place a call to sprintf() between the clock_gettime()
calls, such as
clock_gettime( CLOCK_REALTIME, &start );
sprintf( str, “file.txt” );
MyCustomFunction( str );
clock_gettime( CLOCK_REALTIME, &stop );
The times are way off, like in the order to 10E9. Does Anyone have any
suggestions for ways of getting around this problem, or better ways of
testing the timing of functions?
Thanks,
Mathew.