Solved

Process Timing

Posted on 1998-08-26
7
184 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
Comment Utility
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
Comment Utility
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
Comment Utility
*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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Expert Comment

by:jeremydavis
Comment Utility
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
Comment Utility
I'd still doubt that it would work.
0
 

Expert Comment

by:tsauy
Comment Utility
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
Comment Utility
Thank you tsauy.  That's what I was thinking of!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now