emscript on system.h
parent
bda044de1e
commit
4de984bdb8
|
@ -7,10 +7,14 @@
|
||||||
#ifndef BLT_SYSTEM_H
|
#ifndef BLT_SYSTEM_H
|
||||||
#define BLT_SYSTEM_H
|
#define BLT_SYSTEM_H
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifndef __EMSCRIPTEN__
|
||||||
#include <intrin.h>
|
#ifdef _WIN32
|
||||||
|
#include <intrin.h>
|
||||||
|
#else
|
||||||
|
#include <x86intrin.h>
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <x86intrin.h>
|
#include <chrono>
|
||||||
#endif
|
#endif
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
@ -21,7 +25,11 @@ namespace blt::system {
|
||||||
// #define GNU_INLINE
|
// #define GNU_INLINE
|
||||||
//#endif
|
//#endif
|
||||||
inline std::uint64_t rdtsc(){
|
inline std::uint64_t rdtsc(){
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
return std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
||||||
|
#else
|
||||||
return __rdtsc();
|
return __rdtsc();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// TODO: system memory and current CPU usage. (Linux Only currently)
|
// TODO: system memory and current CPU usage. (Linux Only currently)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue