5 // Created by James McIlree on 10/9/13.
6 // Copyright (c) 2013 Apple. All rights reserved.
13 static mach_timebase_info_data_t timebase_info
;
15 Timer::Timer(const char* message
) : _message(message
) {
16 // C++ guarantees that static variable initialization is thread safe.
17 // We don't actually care what the returned value is, we just want to init timebase_info
18 // The pragma prevents spurious warnings.
19 static kern_return_t blah
= mach_timebase_info(&timebase_info
);
22 _start
= AbsTime::now(); // Do this after the initialization check.
27 _end
= AbsTime::now();
28 printf("%s: %5.5f seconds\n", _message
.c_str(), (double)(_end
- _start
).nano_time().value() / (double)NANOSECONDS_PER_SECOND
);