summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/cpu_clock/clock.h
diff options
context:
space:
mode:
authormonster <[email protected]>2022-07-07 14:41:37 +0300
committermonster <[email protected]>2022-07-07 14:41:37 +0300
commit06e5c21a835c0e923506c4ff27929f34e00761c2 (patch)
tree75efcbc6854ef9bd476eb8bf00cc5c900da436a2 /library/cpp/yt/cpu_clock/clock.h
parent03f024c4412e3aa613bb543cf1660176320ba8f4 (diff)
fix ya.make
Diffstat (limited to 'library/cpp/yt/cpu_clock/clock.h')
-rw-r--r--library/cpp/yt/cpu_clock/clock.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/library/cpp/yt/cpu_clock/clock.h b/library/cpp/yt/cpu_clock/clock.h
new file mode 100644
index 00000000000..96f22c3833b
--- /dev/null
+++ b/library/cpp/yt/cpu_clock/clock.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#include "public.h"
+
+#include <util/datetime/base.h>
+
+namespace NYT {
+
+////////////////////////////////////////////////////////////////////////////////
+
+//! Returns the current processor clock (rdtsc).
+TCpuInstant GetCpuInstant();
+
+//! Returns the current time (obtained via #GetCpuInstant).
+TInstant GetInstant();
+
+//! Converts a number of processor ticks into a regular duration.
+TDuration CpuDurationToDuration(TCpuDuration cpuDuration);
+
+//! Converts a regular duration into the number of processor ticks.
+TCpuDuration DurationToCpuDuration(TDuration duration);
+
+//! Converts a processor clock into the regular time instant.
+TInstant CpuInstantToInstant(TCpuInstant cpuInstant);
+
+//! Converts a regular time instant into the processor clock.
+TCpuInstant InstantToCpuInstant(TInstant instant);
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYT
+
+#define CLOCK_INL_H_
+#include "clock-inl.h"
+#undef CLOCK_INL_H_