?
Solved

Taking time measurements

Posted on 2000-02-22
8
Medium Priority
?
210 Views
Last Modified: 2013-11-15
I need to make exact (with at least 0.01 sec) time measurements. Is there a normal function to do that, like there is "tic" and "toc" in Matlab?

If the answer involves MFC, tell me so in a comment, I will erase this question and repost it into that appropriate section.

What I mean is:

<start timer>
<make a run>
<stop timer>
0
Comment
Question by:Lescha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 120 total points
ID: 2547745
You can easily do this by calling 'GetTickCount()'
0
 
LVL 86

Expert Comment

by:jkr
ID: 2547753
To elaborate - a call to 'GetTickCount()' returns the number of milliseconds that have elapsed since Windows was started. So if you want to measure the amount of time a certain operation takes, use

DWORD dwBefore;
DWORD dwAfter;
DWORD dwMillisecondsElapsed;

dwBefore = GetTickCount();

// processing here...

dwAfter = GetTickCount();

dwMillisecondsElapsed = dwAfter - dwBefore;
0
 
LVL 22

Expert Comment

by:nietod
ID: 2547837
The problem with that  (well actually with ANY solution, so no criticism of what jkr said) is that windows is a mult-tasking system so high precission timing at the application level is not possible.  If your app is suspended fir 1/2 second during the run you don't have 0.1 accuracy.  

There are things that can be done to make timing more reliable, but you will still find that it isn't perfect.
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 86

Expert Comment

by:jkr
ID: 2547952
A little bit 'off topic' -  I seem to have some trouble with email notifications (haven't even been informed about nietod's comment by now), is anybody else experiencing this also?
0
 
LVL 22

Expert Comment

by:nietod
ID: 2548104
I didn't get an e-mail about my comment either.  :-)

I got yours though.
0
 
LVL 1

Author Comment

by:Lescha
ID: 2551632
Thanks, "jkr", "nietod".

As to notifications: no problem here, I received them all. Maybe some temporary problem on your server, "jkr"?

Lescha
0
 
LVL 86

Expert Comment

by:jkr
ID: 2551918
>>Maybe some temporary problem on your
>>server

I hope so - but when there's a problem, it is not due to *my* server, as it is next to me... but maybe a unreliable relay host in between...
0
 
LVL 1

Author Comment

by:Lescha
ID: 2557251
Both for "jkr" and "nietod" - I don't know of any other way to attract your attention to a very interesting problem I've been trying to solve for several months now. Please take a look at this question:

http://www.experts-exchange.com/jsp/qShow.jsp?ta=mfc&qid=10266344 

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Curious about the latest ransomware attack? Check out our timeline of events surrounding the spread of this new virus along with tips on how to mitigate the damage.
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question