Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Profiler for Windows (Read 9036 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Profiler for Windows

Hi, does anyone know of a good profiler that runs under Windows or from the Command Prompt  in Windows?  I've been working with a variety of DSP algorithms and would like to profile the times.  I know that there is gprof in Linux but unfortunately my current OS is Windows XP since I plan to later use these algorithms in a Windows based application. 

Currently I'm keeping these algorithms very straight-forward from a source code perspective.  I'm coding them in C++, just using built-in functionality and the STL, so I end up with a very simple "exe" file after compiling.  I'm hoping that there is something out there that will profile the workings of the exe and give me a duration time of a loop where DSP calculations occur.  I've done a good bit of web searching for such an application and have come up empty handed.

Any assistance would be appreciated.  Thank you.

Zeke

Profiler for Windows

Reply #1
I'm not sure if you are looking for a commercial application or something that's freeware.  Off the top of my head, I think that AutomatedQA's AQTime is a good profiler and fairly flexible.  You can find more info about it here

There are also some freeware apps and profiling libraries.  Try a Google search for "C++ profiler".  I just tried it myself and came up with quite a few options.  If you need some help narrowing down your choices, feel free to send me a private message.


Profiler for Windows

Reply #3
Would GetTickCount() or high res timestamp instrumentation be sufficient? Because if it is, it is probably going to be more accurate than profiling. It's notoriously unreliable.



Profiler for Windows

Reply #6
Thanks for the feedback everyone.  Yes, free would be nice but if I like it I'm more than happy to pay for it.  I am using all Intel processors - currently a P4 in my main machine, and a Celeron D in my web browser machine and I plan to build a Core 2 Duo system in about a week or two.  Yes, using "C++ Profiler" does seem to turn up better results, I was doing searches similar to "source code profiler" or "time profiler" the best I was mainly getting Linux based profilers.  So yes, the feedback helps a lot.  I plan to give the listed profilers you all have mentioned a try.

Would GetTickCount() or high res timestamp instrumentation be sufficient?


I used to use GetTickCount() but I can never get below 16 ms of precision with it - times would always jump by 16 ms.  Best I could do is make the loop grind through a lot of data and then take results from that and then do many tests and average the results.  That's not so bad, but I was looking that gives a bit more feedback and something that I don't need to link to Win32 libs to use.

Thanks,
Zeke

Profiler for Windows

Reply #7
I used to use GetTickCount() but I can never get below 16 ms of precision with it - times would always jump by 16 ms.

Search for QueryPerformanceCounter().
Best I could do is make the loop grind through a lot of data and then take results from that and then do many tests and average the results.

Erm, whatever method you use you will _always_ have to run your
code in a loop if you want correct values. If you don't know why,
then by all means don't write your own profiling code and use VTune.
That's not so bad, but I was looking that gives a bit more feedback
and something that I don't need to link to Win32 libs to use.

GetTickCount() and QueryPerformanceCounter() are exported
by kernel32.dll, you don't need to link with any library to use them.

Profiler for Windows

Reply #8
Quote
GetTickCount() and QueryPerformanceCounter() are exported
by kernel32.dll, you don't need to link with any library to use them.


After searching for "C++ Profiler" as suggested in another post the first result I got was a project at "The Code Project" which wasn't so great but that lead me to another project that was a very nice little class that used QueryPerformanceCounter() which I was unaware of and seems to give great precision.  With the Code Project example class all you have to do is place Start() and End() calls around the section of code you want timed.

If you're interested:
http://www.codeproject.com/cpp/duration.asp

I haven't yet got to checking out VTune and other big name professional profilers.  One question though, I'm assuming with the professional profilers no change is needed to my source code for analysis, is this correct?  I'm thinking that because the profiler has access to my code and the exe file it will be able to analyze both, and then be able to tell me in a report how much time each line, loop, etc takes... Yes?  Hopefully?

Zeke



Profiler for Windows

Reply #11
After searching for "C++ Profiler" as suggested in another post the first result I got was a project at "The Code Project" which wasn't so great but that lead me to another project that was a very nice little class that used QueryPerformanceCounter() which I was unaware of and seems to give great precision.

That's what I meant with "don't write your own profiling code". This class does not
take into account task switching, processor affinity, KB 274323, etc. Better use a tool.

Profiler for Windows

Reply #12

After searching for "C++ Profiler" as suggested in another post the first result I got was a project at "The Code Project" which wasn't so great but that lead me to another project that was a very nice little class that used QueryPerformanceCounter() which I was unaware of and seems to give great precision.

That's what I meant with "don't write your own profiling code". This class does not
take into account task switching, processor affinity, KB 274323, etc. Better use a tool.

I understand what you're saying - point well taken.  However, if I'm just timing DSP processing loops (e.g. FFT processing) done in a C++ console application and time the loop with QueryPerformanceCounter() without having any other programs running that should be sufficient for what I'm doing wouldn't you think.

My idea is to time each program maybe 20 times and then take the average and then use this for comparisons.  Even if it is picking up some extra cycles not related to the DSP processing the relative times will still be the info I'm looking for.  In other words, I'm not looking for exactly (to the microsecond) how long the DSP processing is taking, but more how long one FFT takes compared to another.

Zeke