Solved

Process Timing

Posted on 1998-08-26
7
195 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Suggested Solutions

Title # Comments Views Activity
VB.NET how to use the Vertical ScrollBar 5 114
repeatEnd java challenge 42 85
NotAlone Challenge 20 84
Excel file not created as expected 7 79
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

827 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