ColPack
|
00001 /************************************************************************************ 00002 Copyright (C) 2005-2008 Assefaw H. Gebremedhin, Arijit Tarafdar, Duc Nguyen, 00003 Alex Pothen 00004 00005 This file is part of ColPack. 00006 00007 ColPack is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU Lesser General Public License as published 00009 by the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 ColPack is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with ColPack. If not, see <http://www.gnu.org/licenses/>. 00019 ************************************************************************************/ 00020 00021 #include "Definitions.h" 00022 00023 #ifdef SYSTEM_TIME 00024 00025 #include <sys/times.h> 00026 00027 #ifndef CLK_TCK 00028 #define CLK_TCK 100 00029 #endif 00030 00031 #else 00032 00033 #include <ctime> 00034 00035 #endif 00036 00037 using namespace std; 00038 00039 #ifndef TIMER_H 00040 #define TIMER_H 00041 00042 namespace ColPack 00043 { 00052 class Timer 00053 { 00054 private: 00055 00057 00063 #ifdef SYSTEM_TIME 00064 00065 struct tms tms_BeginTimer; 00066 struct tms tms_EndTimer; 00067 #endif 00068 00069 clock_t ct_BeginTimer; 00070 clock_t ct_EndTimer; 00071 00072 00073 public: 00074 00075 //Public Constructor 4351 00076 Timer(); 00077 00078 //Public Destructor 4352 00079 ~Timer(); 00080 00081 //Public Function 4354 00082 void Start(); 00083 00084 //Public Function 4355 00085 void Stop(); 00086 00087 //Public Function 4356 00088 double GetWallTime(); 00089 00090 //Public Function 4357 00091 double GetProcessorTime(); 00092 00093 //Public Function 4358 00094 double GetUserProcessorTime(); 00095 00096 //Public Function 4359 00097 double GetSystemProcessorTime(); 00098 }; 00099 } 00100 #endif