]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/third-party/folly/folly/chrono/Hardware.h
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
8 #include <folly/Portability.h>
13 #if _MSC_VER && (defined(_M_IX86) || defined(_M_X64))
14 extern "C" std::uint64_t __rdtsc();
15 #pragma intrinsic(__rdtsc)
20 inline std::uint64_t hardware_timestamp() {
21 #if _MSC_VER && (defined(_M_IX86) || defined(_M_X64))
23 #elif __GNUC__ && (__i386__ || FOLLY_X64)
24 return __builtin_ia32_rdtsc();
26 // use steady_clock::now() as an approximation for the timestamp counter on
28 return std::chrono::steady_clock::now().time_since_epoch().count();