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
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 }
0066 #endif