library: libCore #include "TStopwatch.h"

# TStopwatch

class description - source file - inheritance tree (.pdf)

## class TStopwatch : public TObject

| Inheritance Chart:
`TObject`
| <- | `TStopwatch` |

        private:

          static Double_t GetCPUTime()
          static Double_t GetRealTime()

        public:

                          TStopwatch()
                          TStopwatch(const TStopwatch&)
                          ~TStopwatch()
           static TClass* Class()
                     void Continue()
                    Int_t Counter() const
                 Double_t CpuTime()
          virtual TClass* IsA() const
              TStopwatch& operator=(const TStopwatch&)
             virtual void Print(Option_t* option = "") const
                 Double_t RealTime()
                     void Reset()
                     void ResetCpuTime(Double_t time = 0)
                     void ResetRealTime(Double_t time = 0)
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
                     void Start(Bool_t reset = kTRUE)
                     void Stop()
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)

### Data Members

        private:

                    Double_t fStartRealTime  wall clock start time
                    Double_t fStopRealTime   wall clock stop time
                    Double_t fStartCpuTime   cpu start time
                    Double_t fStopCpuTime    cpu stop time
                    Double_t fTotalCpuTime   total cpu time
                    Double_t fTotalRealTime  total real time
          TStopwatch::EState fState          stopwatch state
                       Int_t fCounter        number of times the stopwatch was started

        public:

          static const TStopwatch::EState kUndefined
          static const TStopwatch::EState kStopped
          static const TStopwatch::EState kRunning

## Class Description

     TStopwatch

     Stopwatch class. This class returns the real and cpu time between
     the start and stop events.

TStopwatch()

     Create a stopwatch and start it.

void Start(Bool_t reset)

     Start the stopwatch. If reset is kTRUE reset the stopwatch before
     starting it (including the stopwatch counter).
     Use kFALSE to continue timing after a Stop() without
     resetting the stopwatch.

void Stop()

     Stop the stopwatch.

void Continue()

     Resume a stopped stopwatch. The stopwatch continues counting from the last
     Start() onwards (this is like the laptimer function).

Double_t RealTime()

     Return the realtime passed between the start and stop events. If the
     stopwatch was still running stop it first.

Double_t CpuTime()

     Return the cputime passed between the start and stop events. If the
     stopwatch was still running stop it first.

Double_t GetRealTime()

     Private static method returning system realtime.

Double_t GetCPUTime()

     Private static method returning system CPU time.

void Print(Option_t *opt) const

     Print the real and cpu time passed between the start and stop events.
     and the number of times (slices) this TStopwatch was called
     (if this number > 1). If opt="m" print out realtime in milli second
     precision. If opt="u" print out realtime in micro second precision.

### Inline Functions

                   void ~TStopwatch()
                  Int_t Counter() const
                   void Reset()
                   void ResetCpuTime(Double_t time = 0)
                   void ResetRealTime(Double_t time = 0)
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
             TStopwatch TStopwatch(const TStopwatch&)
            TStopwatch& operator=(const TStopwatch&)

Author: Fons Rademakers 11/10/95
Last update: root/base:$Name: $:$Id: TStopwatch.cxx,v 1.10 2004/10/04 08:23:22 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *