Definition at line 139 of file Timer.h. References mCpuTime, mFreq, mMode, and mStartTime. Referenced by Impala::Util::TimePlot::Stop(), and Impala::Util::TimeStats::StopTime(). 00140 { 00141 double val; 00142 #ifdef unix 00143 if (mMode == 0) 00144 { 00145 times(&mCpuTime); 00146 mUsrTime = mCpuTime.tms_utime - mUsrTime; 00147 mSysTime = mCpuTime.tms_stime - mSysTime; 00148 val = (double) (mUsrTime + mSysTime) / HZ; 00149 } 00150 else 00151 { 00152 struct timeval splitTime; 00153 gettimeofday(&splitTime, 0); 00154 val = (double) (splitTime.tv_sec - mStartTime.tv_sec); 00155 long uSec = splitTime.tv_usec - mStartTime.tv_usec; 00156 val += (double) uSec / 1000000; 00157 } 00158 #else 00159 if (mMode == 0) 00160 { 00161 mCpuTime = clock() - mCpuTime; 00162 val = (double) mCpuTime / CLOCKS_PER_SEC; 00163 } 00164 else 00165 { 00166 LARGE_INTEGER splitTimeStruct; 00167 QueryPerformanceCounter(&splitTimeStruct); 00168 LONGLONG splitTime = splitTimeStruct.HighPart; 00169 splitTime = splitTime << 32; 00170 splitTime |= splitTimeStruct.LowPart; 00171 splitTime -= mStartTime; 00172 val = (double) splitTime / mFreq; 00173 } 00174 #endif 00175 return val; 00176 }
|