HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
ttauri
cpu_counter_clock.hpp
1
// Copyright Take Vos 2019.
2
// Distributed under the Boost Software License, Version 1.0.
3
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5
#pragma once
6
7
#include "os_detect.hpp"
8
#include <chrono>
9
#if TT_COMPILER == TT_CC_MSVC
10
#include <intrin.h>
11
#elif TT_COMPILER == TT_CC_CLANG
12
#include <x86intrin.h>
13
#elif TT_COMPILER == TT_CC_GCC
14
#include <x86intrin.h>
15
#endif
16
17
namespace
tt {
18
19
struct
cpu_counter_clock
{
20
using
rep = uint64_t;
21
// Technically not nano-seconds, this just a counter.
22
using
period
=
std::nano
;
23
using
duration
=
std::chrono::duration<rep, period>
;
24
using
time_point
=
std::chrono::time_point<cpu_counter_clock>
;
25
static
const
bool
is_steady =
true
;
26
27
static
cpu_counter_clock::time_point
now()
noexcept
{
28
return
time_point
(
duration
(__rdtsc()));
29
}
30
};
31
32
}
tt::cpu_counter_clock
Definition
cpu_counter_clock.hpp:19
std::chrono::duration< rep, period >
std::nano
std::chrono::time_point< cpu_counter_clock >
Generated on Mon Apr 22 2024 12:53:45 for HikoGUI by
1.10.0