tags:

views:

221

answers:

3

I have a MS Visual Studio 2005 application solution. All the code is in C. I want to measure the number of cycles taken for execution by particular functions. Is there any Win32 API which i can use to get the cycle count.

I have used gettimeofday() to get time in micro secs, but i want to know the cycles consumed?

-AD

+1  A: 

Sounds to me like you need a profiler. If you are running VS 2005 Team Server Edition it should be included. Otherwise, I've heard good things about: AQtime

Rob Rolnick
A: 

To get accurate measurements you should use QueryPerformanceCounter

Here is Microsoft article:

How To Use QueryPerformanceCounter to Time Code

aku
A: 

Both Intel and AMD offer windows libraries and tools to access the performance counters on their cpus. These give access not only to cycle counts, but also to cache line hits and misses and TLB flush counts. The Intel tools are marketed under the name VTune, while AMD calls theirs CodeAnalyst.

Jonathan Stanton