CMS 3D CMS Logo

CPUTimer.h

Go to the documentation of this file.
00001 #ifndef FWCore_Utilities_CPUTimer_h
00002 #define FWCore_Utilities_CPUTimer_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Utilities
00006 // Class  :     CPUTimer
00007 // 
00016 //
00017 // Original Author:  Chris Jones
00018 //         Created:  Sun Apr 16 20:32:13 EDT 2006
00019 // $Id: CPUTimer.h,v 1.3 2007/06/14 02:00:58 wmtan Exp $
00020 //
00021 
00022 // system include files
00023 #include <sys/time.h>
00024 
00025 // user include files
00026 
00027 // forward declarations
00028 namespace edm {
00029 class CPUTimer
00030 {
00031 
00032    public:
00033       CPUTimer();
00034       virtual ~CPUTimer();
00035 
00036       // ---------- const member functions ---------------------
00037       double realTime() const ;
00038       double cpuTime() const ;
00039       
00040       // ---------- static member functions --------------------
00041 
00042       // ---------- member functions ---------------------------
00043       void start();
00044       void stop();
00045       void reset();
00046       
00047    private:
00048       CPUTimer(const CPUTimer&); // stop default
00049 
00050       const CPUTimer& operator=(const CPUTimer&); // stop default
00051 
00052       struct Times {
00053         double real_;
00054         double cpu_;
00055       };
00056       
00057       Times calculateDeltaTime() const;
00058       
00059       // ---------- member data --------------------------------
00060       enum State {kRunning, kStopped} state_;
00061       struct timeval startRealTime_;
00062       struct timeval startCPUTime_;
00063       
00064       double accumulatedRealTime_;
00065       double accumulatedCPUTime_;
00066       
00067 };
00068 }
00069 
00070 #endif

Generated on Tue Jun 9 17:36:41 2009 for CMSSW by  doxygen 1.5.4