Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Timer.h

Go to the documentation of this file.
00001 // -*- mode: C++; c-file-style: "stroustrup"; c-basic-offset: 4; indent-tabs-mode: nil; -*-
00002 ////////////////////////////////////////////////////////////////////
00003 //
00004 // Filename : Timer.h (base)
00005 //
00006 // This file is a part of the UPPAAL toolkit.
00007 // Copyright (c) 1995 - 2003, Uppsala University and Aalborg University.
00008 // All right reserved.
00009 //
00010 // v 1.3 reviewed.
00011 // $Id: Timer.h,v 1.6 2004/04/02 22:50:43 behrmann Exp $
00012 //
00013 ///////////////////////////////////////////////////////////////////
00014 
00015 #ifndef INCLUDE_BASE_TIMER_H
00016 #define INCLUDE_BASE_TIMER_H
00017 
00018 #include <iostream>
00019 
00020 namespace base
00021 {
00022     /** A simple timer to measure CPU time.
00023      */
00024     class Timer
00025     {
00026     public:
00027         Timer();
00028         
00029         /** 
00030          * Access to CPU time. Returns the CPU time consumed since the
00031          * last call of this method or since initialization of the 
00032          * object if the method has not been called before.
00033          *
00034          * @returns CPU time in seconds.
00035          */
00036         double getElapsed();
00037         
00038     private:
00039         double startTime;
00040     };
00041 }
00042 
00043 /** 
00044  * Output operator for Timer class. Writes the consumed CPU time to \a
00045  * out. Calls \c getElapsed() internally, so the timer is reset.  Up
00046  * to 3 decimals are printed.
00047  */
00048 std::ostream& operator << (std::ostream& out, base::Timer& t);
00049 
00050 #endif // INCLUDE_BASE_TIMER_H

Generated on Fri Jun 30 00:02:30 2006 for Module base by  doxygen 1.4.2