diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-03-04 14:03:06 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-03-04 14:03:06 +0300 |
commit | b61be8e632d1cafa8afb229ea0a5b6117ca7125b (patch) | |
tree | 96a36f21d4064f32d1912cbc85e4135788ff70b3 /contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/sysinfo.cc | |
parent | 7ce58bf82abf75fdc15c2e6fa3aceadcfecfdca1 (diff) | |
download | ydb-b61be8e632d1cafa8afb229ea0a5b6117ca7125b.tar.gz |
intermediate changes
ref:c67faec740b4d59ed47c6dfdc7076c904650af60
Diffstat (limited to 'contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/sysinfo.cc')
-rw-r--r-- | contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/sysinfo.cc | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/sysinfo.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/sysinfo.cc index 9eb0cf3f8c..6a1ef60711 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/sysinfo.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/sysinfo.cc @@ -58,7 +58,7 @@ #include "y_absl/base/thread_annotations.h" namespace y_absl { -ABSL_NAMESPACE_BEGIN +Y_ABSL_NAMESPACE_BEGIN namespace base_internal { namespace { @@ -210,7 +210,7 @@ static bool ReadLongFromFile(const char *file, long *value) { return ret; } -#if defined(ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY) +#if defined(Y_ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY) // Reads a monotonic time source and returns a value in // nanoseconds. The returned value uses an arbitrary epoch, not the @@ -295,7 +295,7 @@ static double MeasureTscFrequency() { return last_measurement; } -#endif // ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY +#endif // Y_ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY static double GetNominalCPUFrequency() { long freq = 0; @@ -312,7 +312,7 @@ static double GetNominalCPUFrequency() { return freq * 1e3; // Value is kHz. } -#if defined(ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY) +#if defined(Y_ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY) // On these platforms, the TSC frequency is the nominal CPU // frequency. But without having the kernel export it directly // though /sys/devices/system/cpu/cpu0/tsc_freq_khz, there is no @@ -335,13 +335,13 @@ static double GetNominalCPUFrequency() { } return 1.0; -#endif // !ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY +#endif // !Y_ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY } #endif -ABSL_CONST_INIT static once_flag init_num_cpus_once; -ABSL_CONST_INIT static int num_cpus = 0; +Y_ABSL_CONST_INIT static once_flag init_num_cpus_once; +Y_ABSL_CONST_INIT static int num_cpus = 0; // NumCPUs() may be called before main() and before malloc is properly // initialized, therefore this must not allocate memory. @@ -352,8 +352,8 @@ int NumCPUs() { } // A default frequency of 0.0 might be dangerous if it is used in division. -ABSL_CONST_INIT static once_flag init_nominal_cpu_frequency_once; -ABSL_CONST_INIT static double nominal_cpu_frequency = 1.0; +Y_ABSL_CONST_INIT static once_flag init_nominal_cpu_frequency_once; +Y_ABSL_CONST_INIT static double nominal_cpu_frequency = 1.0; // NominalCPUFrequency() may be called before main() and before malloc is // properly initialized, therefore this must not allocate memory. @@ -415,16 +415,16 @@ pid_t GetTID() { #else // Fallback implementation of GetTID using pthread_getspecific. -ABSL_CONST_INIT static once_flag tid_once; -ABSL_CONST_INIT static pthread_key_t tid_key; -ABSL_CONST_INIT static y_absl::base_internal::SpinLock tid_lock( +Y_ABSL_CONST_INIT static once_flag tid_once; +Y_ABSL_CONST_INIT static pthread_key_t tid_key; +Y_ABSL_CONST_INIT static y_absl::base_internal::SpinLock tid_lock( y_absl::kConstInit, base_internal::SCHEDULE_KERNEL_ONLY); // We set a bit per thread in this array to indicate that an ID is in // use. ID 0 is unused because it is the default value returned by // pthread_getspecific(). -ABSL_CONST_INIT static std::vector<uint32_t> *tid_array - ABSL_GUARDED_BY(tid_lock) = nullptr; +Y_ABSL_CONST_INIT static std::vector<uint32_t> *tid_array + Y_ABSL_GUARDED_BY(tid_lock) = nullptr; static constexpr int kBitsPerWord = 32; // tid_array is uint32_t. // Returns the TID to tid_array. @@ -495,14 +495,14 @@ pid_t GetTID() { // userspace construct) to avoid unnecessary system calls. Without this caching, // it can take roughly 98ns, while it takes roughly 1ns with this caching. pid_t GetCachedTID() { -#ifdef ABSL_HAVE_THREAD_LOCAL +#ifdef Y_ABSL_HAVE_THREAD_LOCAL static thread_local pid_t thread_id = GetTID(); return thread_id; #else return GetTID(); -#endif // ABSL_HAVE_THREAD_LOCAL +#endif // Y_ABSL_HAVE_THREAD_LOCAL } } // namespace base_internal -ABSL_NAMESPACE_END +Y_ABSL_NAMESPACE_END } // namespace y_absl |