aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/unscaledcycleclock.cc
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/unscaledcycleclock.cc
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/unscaledcycleclock.cc')
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/unscaledcycleclock.cc78
1 files changed, 39 insertions, 39 deletions
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/unscaledcycleclock.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/unscaledcycleclock.cc
index 072a9852fa..4bbbc2621b 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/unscaledcycleclock.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/unscaledcycleclock.cc
@@ -21,18 +21,18 @@
#endif
#if defined(__powerpc__) || defined(__ppc__)
-#ifdef __GLIBC__
+#ifdef __GLIBC__
#include <sys/platform/ppc.h>
-#elif defined(__FreeBSD__)
-#include <sys/sysctl.h>
-#include <sys/types.h>
-#endif
+#elif defined(__FreeBSD__)
+#include <sys/sysctl.h>
+#include <sys/types.h>
#endif
+#endif
#include "y_absl/base/internal/sysinfo.h"
namespace y_absl {
-ABSL_NAMESPACE_BEGIN
+ABSL_NAMESPACE_BEGIN
namespace base_internal {
#if defined(__i386__)
@@ -62,47 +62,47 @@ double UnscaledCycleClock::Frequency() {
#elif defined(__powerpc__) || defined(__ppc__)
int64_t UnscaledCycleClock::Now() {
-#ifdef __GLIBC__
+#ifdef __GLIBC__
return __ppc_get_timebase();
-#else
-#ifdef __powerpc64__
- int64_t tbr;
- asm volatile("mfspr %0, 268" : "=r"(tbr));
- return tbr;
-#else
- int32_t tbu, tbl, tmp;
- asm volatile(
- "0:\n"
- "mftbu %[hi32]\n"
- "mftb %[lo32]\n"
- "mftbu %[tmp]\n"
- "cmpw %[tmp],%[hi32]\n"
- "bne 0b\n"
- : [ hi32 ] "=r"(tbu), [ lo32 ] "=r"(tbl), [ tmp ] "=r"(tmp));
- return (static_cast<int64_t>(tbu) << 32) | tbl;
-#endif
-#endif
+#else
+#ifdef __powerpc64__
+ int64_t tbr;
+ asm volatile("mfspr %0, 268" : "=r"(tbr));
+ return tbr;
+#else
+ int32_t tbu, tbl, tmp;
+ asm volatile(
+ "0:\n"
+ "mftbu %[hi32]\n"
+ "mftb %[lo32]\n"
+ "mftbu %[tmp]\n"
+ "cmpw %[tmp],%[hi32]\n"
+ "bne 0b\n"
+ : [ hi32 ] "=r"(tbu), [ lo32 ] "=r"(tbl), [ tmp ] "=r"(tmp));
+ return (static_cast<int64_t>(tbu) << 32) | tbl;
+#endif
+#endif
}
double UnscaledCycleClock::Frequency() {
-#ifdef __GLIBC__
+#ifdef __GLIBC__
return __ppc_get_timebase_freq();
#elif defined(_AIX)
// This is the same constant value as returned by
// __ppc_get_timebase_freq().
return static_cast<double>(512000000);
-#elif defined(__FreeBSD__)
- static once_flag init_timebase_frequency_once;
- static double timebase_frequency = 0.0;
- base_internal::LowLevelCallOnce(&init_timebase_frequency_once, [&]() {
- size_t length = sizeof(timebase_frequency);
- sysctlbyname("kern.timecounter.tc.timebase.frequency", &timebase_frequency,
- &length, nullptr, 0);
- });
- return timebase_frequency;
-#else
-#error Must implement UnscaledCycleClock::Frequency()
-#endif
+#elif defined(__FreeBSD__)
+ static once_flag init_timebase_frequency_once;
+ static double timebase_frequency = 0.0;
+ base_internal::LowLevelCallOnce(&init_timebase_frequency_once, [&]() {
+ size_t length = sizeof(timebase_frequency);
+ sysctlbyname("kern.timecounter.tc.timebase.frequency", &timebase_frequency,
+ &length, nullptr, 0);
+ });
+ return timebase_frequency;
+#else
+#error Must implement UnscaledCycleClock::Frequency()
+#endif
}
#elif defined(__aarch64__)
@@ -148,7 +148,7 @@ double UnscaledCycleClock::Frequency() {
#endif
} // namespace base_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace y_absl
#endif // ABSL_USE_UNSCALED_CYCLECLOCK