Performance measurement of a single method



 DEVELOP > c-Plus-Plus > Performance measurement of a single method

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Andreas Göbel"
Date: 30 Mar 2006 06:28:36 AM
Object: Performance measurement of a single method
Hi all,
I'm looking for an approach to simply measure the performance (time
consumption in milliseconds) of a single method call. I already tried to use
the windows system time (sys/timeb.h) for that but the accuracy of the
result is too low (moves between 0 and 10 milliseconds). Is there any
possibility to measure more precises without using an external (costly)
profiler or does anybody know a free profiler on windows?
Regards
.

User: "Jakob Bieling"

Title: Re: Performance measurement of a single method 30 Mar 2006 06:57:42 AM
Andreas Göbel <andreas.goebel@sap.com> wrote:

Hi all,
I'm looking for an approach to simply measure the performance (time
consumption in milliseconds) of a single method call. I already tried
to use the windows system time (sys/timeb.h) for that but the
accuracy of the result is too low (moves between 0 and 10
milliseconds). Is there any possibility to measure more precises
without using an external (costly) profiler or does anybody know a
free profiler on windows?

Instead of measuring the time it takes to execute the functions
once, you could measure the time it takes to execute the function
1,000,000 times. Or 4,000,000, depending on how expensive your function
is.
If we are talking about tiny functions, then the loop could have
undesired relative impact on the timing. In that case I suggest you take
a look at the assembly, strop the function call (or inlined function
code) from it and measure the time it takes to execute the empty loop.
hth
--
jb
(reply address in rot13, unscramble first)
.

User: "Phlip"

Title: Re: Performance measurement of a single method 30 Mar 2006 08:35:35 AM
Andreas Göbel wrote:

I'm looking for an approach to simply measure the performance (time
consumption in milliseconds) of a single method call. I already tried to
use
the windows system time (sys/timeb.h) for that but the accuracy of the
result is too low (moves between 0 and 10 milliseconds). Is there any
possibility to measure more precises without using an external (costly)
profiler or does anybody know a free profiler on windows?

Write a test case (you do _have_ unit tests, don't you?) that calls the
function one zillion times. Time the test case. Time it again with the
function commented out.
--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
.

User: "Amal P"

Title: Re: Performance measurement of a single method 30 Mar 2006 06:40:02 AM
Hi,
You can surely use QuerryPerfornanceTimer or you can do it by using
rdtsc. rdtsc is an instruction that reads the timestamp in pentium 4.
Please refer Intel Instruction set reference manuals for this.Querry
performance timer can be very easly used. It can give in allmost 1ms
resolution.
Best Regards,
Amal P.
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER