Solved

Process Timing

Posted on 1998-08-26
7
196 Views
Last Modified: 2013-11-19
I am working on some realtime data acquisition and I want to time a preocess in my program. I need to know how long it takes to Invalidate a whole screen and if I wrote a function how long it takes to process that function..How do I do that ?
0
Comment
Question by:guranimo
  • 4
  • 2
7 Comments
 
LVL 7

Expert Comment

by:psdavis
ID: 1321304
Have you looked at the profiling option available for VC5?  It's not overly exciting but it can give you some of the information you might be looking for.

Phillip
0
 
LVL 1

Accepted Solution

by:
jeremydavis earned 20 total points
ID: 1321305
long int howlong = 0;

void function(void)
{
   SetTimer(111, 1L, NULL);
   //1L = 1mS timer
      :
      :
      //do something
      :
      :
   KillTimer(111);
   TRACE("To in function = %ld\n", howlong);
}

void OnTimer(UINT nIDEvent)
{
   // TODO: Add your message handler code here and/or call
 
   howlong++;      
   CDialog::OnTimer(nIDEvent);
   //CDialog::OnTimer() is assuming you have a dialog base app
}
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1321306
*Probably* a nieve answer.  If I'm not mistaken, the OnTimer function is always the last on the stack of things to do.  You'd probably not get any responses at all.

Phillip
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:jeremydavis
ID: 1321307
If you do find the OnTimer last on the stack you could always use the old favourite PeekAndPmup to allow processing allotment for the timer
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1321308
I'd still doubt that it would work.
0
 

Expert Comment

by:tsauy
ID: 1321309
Another function, GetTickCount(), may do better job than SetTimer(), because the former is from the system clock and supposed to be very accurate. However, if you need a stopwatch with time resolution better than 1 msec, both GetTickCount() and SetTimer() are out of scope. For win95/98, the time resolution of SetTimer() is around 20-50 msec, according to my experiments (somebody corrects me if I am wrong).
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1321310
Thank you tsauy.  That's what I was thinking of!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 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