Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:09:53

0001 #ifndef ATOOLS_Org_MyTiming_H
0002 #define ATOOLS_Org_MyTiming_H
0003 #include <sys/times.h>
0004 #include <time.h>
0005 #include <string>
0006 
0007 #ifndef CLK_TCK
0008 #define CLK_TCK CLOCKS_PER_SEC
0009 #endif
0010 
0011 namespace ATOOLS {
0012 
0013   std::string FormatTime(const int &in,const int mode=0);
0014 
0015   class MyTiming {
0016     tms starttms, currenttms, stoptms;
0017     clock_t startclock, currentclock, stopclock;
0018     int status;
0019     double clk_tck;
0020     void SetCurrent();
0021   public:
0022     MyTiming();
0023     void Start();
0024     void Stop();
0025     void PrintTime();
0026     double SystemTime();
0027     double UserTime();
0028     double RealTime();
0029     std::string TimeString(const int format=0);
0030     std::string StrFTime(const std::string &format,
0031              const time_t &offset=0);
0032   };
0033 
0034   /*!
0035     \file
0036     \brief Contains the class MyTiming
0037   */
0038 
0039   /*!
0040     \class MyTiming
0041     \brief Simple class for making time measurements
0042   */
0043 
0044   /*!
0045     \fn MyTiming::MyTiming()
0046     \brief Standard constructor
0047   */
0048 
0049   /*!
0050     \fn void MyTiming::Start();
0051     \brief start watch
0052   */
0053 
0054   /*!
0055     \fn void MyTiming::Stop();
0056     \brief stop watch
0057   */
0058 
0059   /*!
0060     \fn void MyTiming::PrintTime();
0061     \brief print results on screen
0062   */
0063 
0064 
0065 }
0066 #endif