]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/stopwatch.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStopWatch
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
11 The wxStopWatch class allow you to measure time intervals.
13 For example, you may use it to measure the time elapsed by some function:
17 CallLongRunningFunction();
18 wxLogMessage("The long running function took %ldms to execute",
21 ... stopwatch is stopped now ...
23 CallLongRunningFunction();
24 wxLogMessage("And calling it twice took $ldms in all", sw.Time());
27 Since wxWidgets 2.9.3 this class uses @c QueryPerformanceCounter()
28 function under MSW to measure the elapsed time. It provides higher
29 precision than the usual timer functions but can suffer from bugs in its
30 implementation in some Windows XP versions. If you encounter such problems,
31 installing a Microsoft hot fix from http://support.microsoft.com/?id=896256
43 Constructor. This starts the stop watch.
48 Pauses the stop watch. Call Resume() to resume time measuring again.
50 If this method is called several times, @c Resume() must be called the same
51 number of times to really resume the stop watch. You may, however, call
52 Start() to resume it unconditionally.
57 Resumes the stop watch which had been paused with Pause().
62 (Re)starts the stop watch with a given initial value.
64 The stopwatch will always be running after calling Start(), even if
65 Pause() had been called before and even if it had been called multiple
68 void Start(long milliseconds
= 0);
71 Returns the time in milliseconds since the start (or restart) or the last
79 Returns elapsed time in microseconds.
81 This method is similar to Time() but returns the elapsed time in
82 microseconds and not milliseconds. Notice that not all platforms really
83 can measure times with this precision.
87 wxLongLong
TimeInMicro() const;