View Single Post
Old 09-06-07, 02:47 PM   #2
AndyS
Registered User
 
Join Date: Feb 2007
Posts: 23
Default Re: C++ Gurus, School Me :D

I'm not sure whether I understand your question, but if you want to measure time consumed by calling some function you can simply use the clock() function for it (as the example stated)

clock() returns number of ticks since the program started. So:
1. you store the no. of ticks before the function call
beginTime = clock();

2. call the function
funcBlaBla();

3. measure no. of ticks after the function returned ..
functionTime = clock() - beginTime;
..and of course transfer the ticks into seconds

..
also note that if you want to measure writing/reading performance of some device you should do it be writing and reading some larger amount of data ..not just few bytes (and there can be also differences in sequential access and random access but I that don't bother you right now )
AndyS is offline   Reply With Quote