lezebulon
lezebulon

Reputation: 7994

How to measure accurately execution time (when < 1 ms)

I am trying to measure the execution time taken by some functions in my C code. I am ussing the difference of time using the clock() function, but I mostly get 0 as a result, since the value of CLOCKS_PER_SEC seems to be set at only 1000 on my implementation.

What are some other ways to measure accurately the execution time of a function? I am using Visual Studio 2010

thanks

edit: I am looking for a time resolution of around 0.1ms, I don't really need more

Upvotes: 0

Views: 924

Answers (1)

Mysticial
Mysticial

Reputation: 471209

You can use performance counters:

http://msdn.microsoft.com/en-us/library/ms644904%28v=vs.85%29.aspx

Upvotes: 3

Related Questions