aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/sysinfo.cc
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/sysinfo.cc
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
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.cc70
1 files changed, 35 insertions, 35 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 8dbe6c3d41..9eb0cf3f8c 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
+ABSL_NAMESPACE_BEGIN
namespace base_internal {
namespace {
@@ -150,23 +150,23 @@ static double GetNominalCPUFrequency() {
// API informing about CPU nominal frequency.
return 1.0;
#else
-#pragma comment(lib, "advapi32.lib") // For Reg* functions.
- HKEY key;
- // Use the Reg* functions rather than the SH functions because shlwapi.dll
- // pulls in gdi32.dll which makes process destruction much more costly.
- if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
- "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 0,
- KEY_READ, &key) == ERROR_SUCCESS) {
- DWORD type = 0;
- DWORD data = 0;
- DWORD data_size = sizeof(data);
- auto result = RegQueryValueExA(key, "~MHz", 0, &type,
- reinterpret_cast<LPBYTE>(&data), &data_size);
- RegCloseKey(key);
- if (result == ERROR_SUCCESS && type == REG_DWORD &&
- data_size == sizeof(data)) {
- return data * 1e6; // Value is MHz.
- }
+#pragma comment(lib, "advapi32.lib") // For Reg* functions.
+ HKEY key;
+ // Use the Reg* functions rather than the SH functions because shlwapi.dll
+ // pulls in gdi32.dll which makes process destruction much more costly.
+ if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
+ "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 0,
+ KEY_READ, &key) == ERROR_SUCCESS) {
+ DWORD type = 0;
+ DWORD data = 0;
+ DWORD data_size = sizeof(data);
+ auto result = RegQueryValueExA(key, "~MHz", 0, &type,
+ reinterpret_cast<LPBYTE>(&data), &data_size);
+ RegCloseKey(key);
+ if (result == ERROR_SUCCESS && type == REG_DWORD &&
+ data_size == sizeof(data)) {
+ return data * 1e6; // Value is MHz.
+ }
}
return 1.0;
#endif // WINAPI_PARTITION_APP && !WINAPI_PARTITION_DESKTOP
@@ -340,34 +340,34 @@ static double GetNominalCPUFrequency() {
#endif
-ABSL_CONST_INIT static once_flag init_num_cpus_once;
-ABSL_CONST_INIT static int num_cpus = 0;
+ABSL_CONST_INIT static once_flag init_num_cpus_once;
+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.
+// NumCPUs() may be called before main() and before malloc is properly
+// initialized, therefore this must not allocate memory.
int NumCPUs() {
- base_internal::LowLevelCallOnce(
- &init_num_cpus_once, []() { num_cpus = GetNumCPUs(); });
+ base_internal::LowLevelCallOnce(
+ &init_num_cpus_once, []() { num_cpus = GetNumCPUs(); });
return num_cpus;
}
-// 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;
-
-// NominalCPUFrequency() may be called before main() and before malloc is
-// properly initialized, therefore this must not allocate memory.
+// 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;
+
+// NominalCPUFrequency() may be called before main() and before malloc is
+// properly initialized, therefore this must not allocate memory.
double NominalCPUFrequency() {
- base_internal::LowLevelCallOnce(
- &init_nominal_cpu_frequency_once,
- []() { nominal_cpu_frequency = GetNominalCPUFrequency(); });
+ base_internal::LowLevelCallOnce(
+ &init_nominal_cpu_frequency_once,
+ []() { nominal_cpu_frequency = GetNominalCPUFrequency(); });
return nominal_cpu_frequency;
}
#if defined(_WIN32)
pid_t GetTID() {
- return pid_t{GetCurrentThreadId()};
+ return pid_t{GetCurrentThreadId()};
}
#elif defined(__linux__)
@@ -504,5 +504,5 @@ pid_t GetCachedTID() {
}
} // namespace base_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace y_absl