Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Timer.h

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.1.1.1 $
00022 // $Date: 2000/09/15 08:23:30 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/utility/Timer.h,v $
00024                                                                         
00025                                                                         
00026 // File: ~/utility/Timer.h
00027 //
00028 // Written: fmk 
00029 // Created: Mar 1997
00030 // Revision: A
00031 //
00032 // Description: This file contains the class definition for Timer.
00033 // Timer is a stopwatch.
00034 //
00035 // What: "@(#) Timer.h, revA"
00036 
00037 #ifndef Timer_h
00038 #define Timer_h
00039 
00040 #ifdef _WIN32
00041 // fill in later
00042 
00043 #else
00044 
00045 #include <time.h>
00046 #include <sys/times.h>
00047 #include <sys/resource.h>
00048 #endif
00049 
00050 #include <iostream.h>
00051 
00060 class Timer
00061 {
00062   public:
00066     Timer();    
00067 
00071     virtual ~Timer();
00072 
00073 
00078     void start(void);
00079 
00084     void pause(void);
00085 
00090     double getReal(void) const;
00091 
00093     double getCPU(void) const;
00094 
00096     int getNumPageFaults(void) const;
00097     
00099     virtual void Print(ostream &s) const;   
00101     friend ostream &operator<<(ostream &s, const Timer &E);    
00102 
00103   protected:
00104     
00105   private:
00106 
00107 #ifdef _WIN32
00108 
00109 // fill in later
00110 
00111 #else
00112     
00114     clock_t t1, t2;
00116     struct tms tmsstart, tmsend;
00118     struct rusage r1usage, r2usage;
00120     struct rusage *r1us, *r2us;
00121 
00122 #endif
00123 };
00124 
00125 
00126 #endif
00127 
Copyright Contact Us