(file) Return to Stopwatch.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

 1 martin 1.22 //%LICENSE////////////////////////////////////////////////////////////////
 2 martin 1.23 //
 3 martin 1.22 // Licensed to The Open Group (TOG) under one or more contributor license
 4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
 5             // this work for additional information regarding copyright ownership.
 6             // Each contributor licenses this file to you under the OpenPegasus Open
 7             // Source License; you may not use this file except in compliance with the
 8             // License.
 9 martin 1.23 //
10 martin 1.22 // Permission is hereby granted, free of charge, to any person obtaining a
11             // copy of this software and associated documentation files (the "Software"),
12             // to deal in the Software without restriction, including without limitation
13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14             // and/or sell copies of the Software, and to permit persons to whom the
15             // Software is furnished to do so, subject to the following conditions:
16 martin 1.23 //
17 martin 1.22 // The above copyright notice and this permission notice shall be included
18             // in all copies or substantial portions of the Software.
19 martin 1.23 //
20 martin 1.22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 martin 1.23 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 martin 1.22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 martin 1.23 //
28 martin 1.22 //////////////////////////////////////////////////////////////////////////
29 mike   1.12 //
30             //%/////////////////////////////////////////////////////////////////////////////
31             
32             #ifndef Pegasus_Stopwatch_h
33             #define Pegasus_Stopwatch_h
34             
35             #include <Pegasus/Common/Config.h>
36 chip   1.18 
37 kumpf  1.14 #include <Pegasus/Common/Linkage.h>
38 mike   1.12 
39             PEGASUS_NAMESPACE_BEGIN
40             
41             /** Stopwatch - A class for measuring elapsed time
42 chip   1.18     Stopwatch is a class for measuring time intervals within the environment.
43 mike   1.12     It is intended to be a developers tool primarily.
44             */
45             class PEGASUS_COMMON_LINKAGE Stopwatch
46             {
47             public:
48             
49 chip   1.18     /** constructor. The constructor creates the object. Start
50                 must be called to start the timer.
51 mike   1.12     @example Stopwatch time;
52                 */
53 kumpf  1.21     Stopwatch();
54 chip   1.18 
55                 /** start - Starts accumulating time and continues until stop is called.
56                 The object can be started and stopped multiple times to measure the
57                 sum of several intervals, but each start must have a corresponding start.
58                 */
59 kumpf  1.21     void start();
60 mike   1.12 
61 chip   1.18     /** stop - Stops the accumlation of time for an interval. The object
62                 should only stopped if it has been started.
63 mike   1.12     */
64 kumpf  1.21     void stop();
65 mike   1.12 
66 chip   1.18     /** reset - Effectively clears the time values stored by a Stopwatch.
67                 */
68 kumpf  1.21     void reset();
69 chip   1.18 
70                 /** getElapsed - Get the elapsed time for the defined stopwatch. This
71                 method should only be called if it is currently stopped.
72 jim.wunderlich 1.19     @return Returns the elapsed time value as a double (in milliseconds).
73 mike           1.12     */
74 kumpf          1.21     double getElapsed() const;
75 mike           1.12 
76 jim.wunderlich 1.19     /** Get number of elapsed microseconds
77                         */
78 kumpf          1.21     Uint64 getElapsedUsec() const;
79 jim.wunderlich 1.19 
80 chip           1.18     /** printElapsed method gets the current value of the timer and
81                         sends it to standard out as a string with the word seconds attached
82 mike           1.12     */
83 kumpf          1.21     void printElapsed();
84 chip           1.18 
85                     private:
86 jim.wunderlich 1.19     Uint64 _start;
87                         Uint64 _stop;
88                         Uint64 _total;
89 mike           1.12 };
90                     
91                     PEGASUS_NAMESPACE_END
92                     
93                     #endif /* Pegasus_Stopwatch_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2