473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
Mar 30 '06 #1
3 2066
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.

Mar 30 '06 #2
Andreas Göbel <an************@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)
Mar 30 '06 #3
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!!!
Mar 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric S. Johansson | last post by:
I've been playing with the profiler and have been rather successful in making my code run faster. So for my best success has been cutting a three second CPU time run down to about 0.45 seconds. ...
0
by: Alex Vinokur | last post by:
=================================== ------------- Sorting ------------- Comparative performance measurement =================================== Testsuite : Comparing Function Objects to...
4
by: zzfreddybb | last post by:
We are using HP aCC compiler on a HP Itanium box ( 11.23) We are having some severe performance hits using exception handling ( try/catch ) scenarios. The online aCC documentation says: HP...
8
by: Sebastian Werner | last post by:
Howdy, I currently develop the javascript toolkit qooxdoo (http://qooxdoo.sourceforge.net), some of you heard it already. We have discovered a slowdown on Internet Explorers performance when...
51
by: Jojo | last post by:
Is there any way to get to the left-hand side of an operator? Consider the following (this is not meant to be perfect code, just an example of the problem): class Matrix { public: int data;...
6
by: Alex Vinokur | last post by:
Here are results of comparative performance tests carried out using the same compiler (gcc 3.2) in different environments (CYGWIN, MINGW, DJGPP) on Windows 2000 Professional. The following...
4
by: Martin | last post by:
I am using graphics as backgrounds for forms,buttons,labels etc. The question is: is it faster to load all graphics from files on app start or to use it embeded (places in editor during design)....
2
by: Jeff S | last post by:
I'm looking for guidance (tutorials, backgrounders, tips, or otherwise) on measuring the performance of ASP.NET applications. I'm specifically interested in acquiring the capability of generating...
1
by: Ted | last post by:
I have cross posted this to comp.lang.c++ and to sci.math.num- analysis in the belief that the topic is of interest to some in both groups. I am building my toolkit, in support of my efforts in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.