2 #include "IncludeWindows.h"
4 #if defined(__linux__) || defined(__MACOS__)
8 #include "UMicroseconds.h"
11 UMicroseconds& UMicroseconds::ReadTime()
14 LARGE_INTEGER Frequency, Count ;
16 QueryPerformanceFrequency(&Frequency) ;
17 QueryPerformanceCounter(&Count);
18 theTime = uint64_t((Count.QuadPart * 1000000.0 / Frequency.QuadPart));
21 #if defined(__linux__) || defined(__MACOS__)
22 // Mac code replaced by posix calls, to reduce Carbon dependency.
25 gettimeofday(&buf,NULL);
28 theTime = uint64_t(buf.tv_sec) * 1000*1000 + buf.tv_usec;
34 Removed in favor of the posix implementation.
36 uint32_t UMicroseconds::hi() {return reinterpret_cast<UnsignedWide*>(&theTime)->hi;}
37 uint32_t UMicroseconds::lo() {return reinterpret_cast<UnsignedWide*>(&theTime)->lo;}
40 void UMicrosecondsAccumulator::Start()
42 m_start_time.ReadTime();
45 void UMicrosecondsAccumulator::Stop()
47 UMicroseconds stop_time;
49 m_accumulator += stop_time.GetNativeTime() - m_start_time.GetNativeTime();
52 void UMicrosecondsAccumulator::Clear()
58 UMicroseconds UMicrosecondsAccumulator::GetAccumulatedTime() const
63 UMicrosecondsAccumulator& UMicrosecondsAccumulator::operator+=(const UMicrosecondsAccumulator& inaccum_to_add)
65 m_accumulator += inaccum_to_add.GetAccumulatedTime();