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

 1 karl  1.20 //%2006////////////////////////////////////////////////////////////////////////
 2 mike  1.12 //
 3 karl  1.16 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
 5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
 6 karl  1.15 // IBM Corp.; EMC Corporation, The Open Group.
 7 karl  1.16 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
 8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
 9 karl  1.17 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
11 karl  1.20 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12            // EMC Corporation; Symantec Corporation; The Open Group.
13 mike  1.12 //
14            // Permission is hereby granted, free of charge, to any person obtaining a copy
15 kumpf 1.13 // of this software and associated documentation files (the "Software"), to
16            // deal in the Software without restriction, including without limitation the
17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 mike  1.12 // sell copies of the Software, and to permit persons to whom the Software is
19            // furnished to do so, subject to the following conditions:
20 karl  1.20 // 
21 kumpf 1.13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 mike  1.12 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 kumpf 1.13 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 mike  1.12 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29            //
30            //==============================================================================
31            //
32            //%/////////////////////////////////////////////////////////////////////////////
33            
34            #ifndef Pegasus_Stopwatch_h
35            #define Pegasus_Stopwatch_h
36            
37            #include <Pegasus/Common/Config.h>
38 chip  1.18 
39 kumpf 1.14 #include <Pegasus/Common/Linkage.h>
40 mike  1.12 
41            PEGASUS_NAMESPACE_BEGIN
42            
43            /** Stopwatch - A class for measuring elapsed time
44 chip  1.18     Stopwatch is a class for measuring time intervals within the environment.
45 mike  1.12     It is intended to be a developers tool primarily.
46            */
47            class PEGASUS_COMMON_LINKAGE Stopwatch
48            {
49            public:
50            
51 chip  1.18     /** constructor. The constructor creates the object. Start
52                must be called to start the timer.
53 mike  1.12     @example Stopwatch time;
54                */
55 kumpf 1.21     Stopwatch();
56 chip  1.18 
57                /** start - Starts accumulating time and continues until stop is called.
58                The object can be started and stopped multiple times to measure the
59                sum of several intervals, but each start must have a corresponding start.
60                */
61 kumpf 1.21     void start();
62 mike  1.12 
63 chip  1.18     /** stop - Stops the accumlation of time for an interval. The object
64                should only stopped if it has been started.
65 mike  1.12     */
66 kumpf 1.21     void stop();
67 mike  1.12 
68 chip  1.18     /** reset - Effectively clears the time values stored by a Stopwatch.
69                */
70 kumpf 1.21     void reset();
71 chip  1.18 
72                /** getElapsed - Get the elapsed time for the defined stopwatch. This
73                method should only be called if it is currently stopped.
74 jim.wunderlich 1.19     @return Returns the elapsed time value as a double (in milliseconds).
75 mike           1.12     */
76 kumpf          1.21     double getElapsed() const;
77 mike           1.12 
78 jim.wunderlich 1.19     /** Get number of elapsed microseconds
79                         */
80 kumpf          1.21     Uint64 getElapsedUsec() const;
81 jim.wunderlich 1.19 
82 chip           1.18     /** printElapsed method gets the current value of the timer and
83                         sends it to standard out as a string with the word seconds attached
84 mike           1.12     */
85 kumpf          1.21     void printElapsed();
86 chip           1.18 
87                     private:
88 jim.wunderlich 1.19     Uint64 _start;
89                         Uint64 _stop;
90                         Uint64 _total;
91 mike           1.12 };
92                     
93                     PEGASUS_NAMESPACE_END
94                     
95                     #endif /* Pegasus_Stopwatch_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2