| 23 | namespace bx |
| 24 | { |
| 25 | int64_t getHPCounter() |
| 26 | { |
| 27 | #if BX_CRT_NONE |
| 28 | int64_t i64 = crt0::getHPCounter(); |
| 29 | #elif BX_PLATFORM_WINDOWS \ |
| 30 | || BX_PLATFORM_XBOXONE \ |
| 31 | || BX_PLATFORM_WINRT |
| 32 | LARGE_INTEGER li; |
| 33 | QueryPerformanceCounter(&li); |
| 34 | int64_t i64 = li.QuadPart; |
| 35 | #elif BX_PLATFORM_ANDROID |
| 36 | struct timespec now; |
| 37 | clock_gettime(CLOCK_MONOTONIC, &now); |
| 38 | int64_t i64 = now.tv_sec*INT64_C(1000000000) + now.tv_nsec; |
| 39 | #elif BX_PLATFORM_EMSCRIPTEN |
| 40 | int64_t i64 = int64_t(1000.0f * emscripten_get_now() ); |
| 41 | #elif !BX_PLATFORM_NONE |
| 42 | struct timeval now; |
| 43 | gettimeofday(&now, NULL); |
| 44 | int64_t i64 = now.tv_sec*INT64_C(1000000) + now.tv_usec; |
| 45 | #else |
| 46 | BX_ASSERT(false, "Not implemented!"); |
| 47 | int64_t i64 = UINT64_MAX; |
| 48 | #endif // BX_PLATFORM_ |
| 49 | return i64; |
| 50 | } |
| 51 | |
| 52 | int64_t getHPFrequency() |
| 53 | { |
no test coverage detected