Timer.hGo 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.4 $ 00022 // $Date: 2003/02/14 23:02:12 $ 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 00042 #else 00043 #ifdef _MAC 00044 #include <sys/time.h> 00045 #else 00046 00047 #include <time.h> 00048 #include <unistd.h> 00049 00050 #endif 00051 #include <sys/times.h> 00052 #include <sys/resource.h> 00053 #endif 00054 00055 #include <OPS_Globals.h> 00056 00057 class Timer 00058 { 00059 public: 00060 Timer(); 00061 virtual ~Timer(); 00062 00063 void start(void); 00064 void pause(void); 00065 double getReal(void) const; 00066 double getCPU(void) const; 00067 int getNumPageFaults(void) const; 00068 00069 virtual void Print(OPS_Stream &s) const; 00070 friend OPS_Stream &operator<<(OPS_Stream &s, const Timer &E); 00071 00072 protected: 00073 00074 private: 00075 00076 #ifdef _WIN32 00077 00078 // fill in later 00079 00080 #else 00081 00082 clock_t t1, t2; 00083 struct tms tmsstart, tmsend; 00084 struct rusage r1usage, r2usage; 00085 struct rusage *r1us, *r2us; 00086 00087 #endif 00088 }; 00089 00090 00091 #endif 00092 |