Click here to Skip to main content
15,911,786 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Mulitple SDI windows. Pin
Vuvirt24-Jan-02 4:52
Vuvirt24-Jan-02 4:52 
GeneralRe: Mulitple SDI windows. Pin
Jon Newman24-Jan-02 5:07
Jon Newman24-Jan-02 5:07 
GeneralRe: Mulitple SDI windows. Pin
Vuvirt25-Jan-02 2:32
Vuvirt25-Jan-02 2:32 
GeneralRe: Mulitple SDI windows. Pin
Jon Newman25-Jan-02 6:43
Jon Newman25-Jan-02 6:43 
GeneralRe: Mulitple SDI windows. Pin
Vuvirt28-Jan-02 21:58
Vuvirt28-Jan-02 21:58 
Generaltimer Pin
Jerome Conus24-Jan-02 1:23
Jerome Conus24-Jan-02 1:23 
GeneralRe: timer Pin
Joaquín M López Muñoz24-Jan-02 2:51
Joaquín M López Muñoz24-Jan-02 2:51 
GeneralRe: timer Pin
HintiFlo24-Jan-02 4:00
HintiFlo24-Jan-02 4:00 
Hi Jerome.
Here's a simple class, it's not my idea, unfortunately I don't know whose copyright it is, I think it's from somwhere at CP:

#pragma once
class CDuration
{
protected:
LARGE_INTEGER m_liStart;
LARGE_INTEGER m_liStop;
LONGLONG m_llFrequency;
LONGLONG m_llCorrection;
public: CDuration(void);
void Start(void);
void Stop(void);
long GetDuration(void) const;
};

inline CDuration::CDuration(void)
{ LARGE_INTEGER liFrequency;
QueryPerformanceFrequency(&liFrequency);
m_llFrequency = liFrequency.QuadPart;
// Calibration
Start();
Stop();
m_llCorrection = m_liStop.QuadPart-m_liStart.QuadPart;
}

inline void CDuration::Start(void)
{ // Ensure we will not be interrupted by any other thread for a while
Sleep(0); QueryPerformanceCounter(&m_liStart);}

inline void CDuration::Stop(void)
{QueryPerformanceCounter(&m_liStop);}

inline long CDuration::GetDuration(void) const
{
return (long)(m_liStop.QuadPart-m_liStart.QuadPart-m_llCorrection)*1000000.0 / m_llFrequency;}

usage e.g.:

CDuration durat;
durat.Start();
FunctionCallToMeasure();
durat.Stop();
long ms_needed = durat.GetDuration();

I think the GetDuration return gives the time in milliseconds. I try to find the docu, then I can tell you more!

Good Luck, Flo
GeneralRe: timer Pin
Jerome Conus24-Jan-02 4:19
Jerome Conus24-Jan-02 4:19 
GeneralRe: timer Pin
HintiFlo30-Jan-02 23:09
HintiFlo30-Jan-02 23:09 
GeneralRe: timer Pin
Jerome Conus31-Jan-02 3:15
Jerome Conus31-Jan-02 3:15 
GeneralApp.path Alternative in c++ dll Pin
jayantbichhal24-Jan-02 0:37
jayantbichhal24-Jan-02 0:37 
GeneralRe: App.path Alternative in c++ dll Pin
Joaquín M López Muñoz24-Jan-02 4:16
Joaquín M López Muñoz24-Jan-02 4:16 
GeneralChild windows inside a class (W32, not MFC) Pin
23-Jan-02 21:38
suss23-Jan-02 21:38 
GeneralRe: Child windows inside a class (W32, not MFC) Pin
Michael P Butler23-Jan-02 22:15
Michael P Butler23-Jan-02 22:15 
GeneralMAC Address Pin
ZAZA23-Jan-02 21:31
ZAZA23-Jan-02 21:31 
QuestionOnChar is not needed in ScrollView? Pin
AnonymousBabe@usa.net23-Jan-02 20:31
AnonymousBabe@usa.net23-Jan-02 20:31 
GeneralSearching Programmer Pin
Sonu Kapoor23-Jan-02 20:22
Sonu Kapoor23-Jan-02 20:22 
GeneralRe: Searching Programmer Pin
Braulio Dez23-Jan-02 23:20
Braulio Dez23-Jan-02 23:20 
GeneralSend Mail! Pin
Mazdak23-Jan-02 18:51
Mazdak23-Jan-02 18:51 
GeneralRe: Send Mail! Pin
Nish Nishant23-Jan-02 19:01
sitebuilderNish Nishant23-Jan-02 19:01 
GeneralRe: Send Mail! Pin
Jon Sagara23-Jan-02 19:18
Jon Sagara23-Jan-02 19:18 
GeneralRe: Send Mail! Pin
Braulio Dez23-Jan-02 23:23
Braulio Dez23-Jan-02 23:23 
GeneralQuestion about Printing Pin
Eugene Pustovoyt23-Jan-02 18:26
Eugene Pustovoyt23-Jan-02 18:26 
GeneralRe: Question about Printing Pin
Mazdak23-Jan-02 18:52
Mazdak23-Jan-02 18:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.