Archived

This topic is now archived and is closed to further replies.

jaggu

clock () implementation?

Recommended Posts

Hello there, I am trying to find the clock speed of the processor. I use the clock () (time.h) function to let a second elapse, then subtract the values returned thru RDTSC instruction (in assembly) invoked before and after the time interval to find the clocks elapsed. Then I divide this by 1,000,000 to find the clock speed in Mhz. My processor is running at 400Mhz and this program gives values from 397.xxx to 401.xxx. Reasonably accurate. I would like to know how clock () is implemented so that I can get a more accurate value. If you like to see source/exe of my program, please visit: http://www.poojyum.com/jlog/ Thanks. jaggu

Share this post


Link to post
Share on other sites
if you''re running msvc. you can just step into the clock(); function. it uses GetSystemTimeAsFileTime.

also check google for clock.c to see some linux implementations of the function.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites