Solved

Taking time measurements

Posted on 2000-02-22
8
208 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 30 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

734 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