clock.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include "public.h"
  3. #include <util/datetime/base.h>
  4. namespace NYT {
  5. ////////////////////////////////////////////////////////////////////////////////
  6. //! Returns the current processor clock (typically obtained via |rdtscp| instruction).
  7. TCpuInstant GetCpuInstant();
  8. //! Returns the approximate current processor clock (obtained via |rdtsc| instruction).
  9. TCpuInstant GetApproximateCpuInstant();
  10. //! Returns the current time (obtained via #GetCpuInstant).
  11. TInstant GetInstant();
  12. //! Converts a number of processor ticks into a regular duration.
  13. TDuration CpuDurationToDuration(TCpuDuration cpuDuration);
  14. //! Converts a regular duration into the number of processor ticks.
  15. TCpuDuration DurationToCpuDuration(TDuration duration);
  16. //! Converts a processor clock into the regular time instant.
  17. TInstant CpuInstantToInstant(TCpuInstant cpuInstant);
  18. //! Converts a regular time instant into the processor clock.
  19. TCpuInstant InstantToCpuInstant(TInstant instant);
  20. ////////////////////////////////////////////////////////////////////////////////
  21. } // namespace NYT
  22. #define CLOCK_INL_H_
  23. #include "clock-inl.h"
  24. #undef CLOCK_INL_H_