Skip to main content
GameDev.net gamedev.net
🔒 Locked

Performance metrics - measuring thread execution time?

Started by Cycles Feb 19, 2009 at 8:19 AM 4 replies 3k views
Original Post
Cycles
Cycles
Hey all, I'm doing some university work, and as my research project I have to write a distributed video decoding framework (sort of, skimming on the details a bit...). My topic is mainly about the feasibility of this, so I'm writing it in a simulation environment. I've spoke with my supervisor about how what statistics would be interesting, and he's mentioned it would be good to see how balanced the distribution is, and wants me to come back with a measure of thread execution time. This is running on Windows, and I've looked through the .NET class libraries and can't find anything useful. Originally, I planned to just use QueryPerformanceCounter - but obviously this will not give a true measure of time spent in a thread (ie, context switches half way through areas I'm timing). I also don't want to lock each region I want to time, as that's hardly representative of what would happen in reality. So, cut the story short - anyone know how I could measure the time spent on a per thread basis? I'm open to other methods, time doesn't necessarily have to mean duration in seconds, I'm thinking my best option may well be to have a "frame cost" variable, that is incremented after various (short) blocks of code execute. Any ideas?
Oliver Charles (aka aCiD2) [ Cycles Blog ]
Antheus
Antheus
Can you choose to use a profiler, or are already provided with one?
Cycles
Cycles
Quote:
Original post by LordShade
GetThreadTimes or GetProcessTimes would be what you're looking for.


Ooooo, this looks very promising! One problem, I'm really trying to time the amount of execution per frame - the thread exists over the whole duration of the program. However, I can probably change the way my program is architectured to work around this.

Thanks a bunch, very helpful :)
Oliver Charles (aka aCiD2) [ Cycles Blog ]
chapter78
chapter78
Intel's VTune is quite good for this, but I don't fully understand how to use it myself.
LordShade
LordShade
You could do a GetThreadTimes prior to the Present of each frame and compute the thread time between the two calls.

However, depending on how you're doing your threading and what you're using it for, you could get thread times all over the place.

Some sort of profiler my be your better bet.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.