|
||||
File indexing completed on 2024-11-15 09:00:52
0001 // Copyright 2022 The Abseil Authors 0002 // 0003 // Licensed under the Apache License, Version 2.0 (the "License"); 0004 // you may not use this file except in compliance with the License. 0005 // You may obtain a copy of the License at 0006 // 0007 // https://www.apache.org/licenses/LICENSE-2.0 0008 // 0009 // Unless required by applicable law or agreed to in writing, software 0010 // distributed under the License is distributed on an "AS IS" BASIS, 0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0012 // See the License for the specific language governing permissions and 0013 // limitations under the License. 0014 0015 #ifndef ABSL_BASE_INTERNAL_UNSCALEDCYCLECLOCK_CONFIG_H_ 0016 #define ABSL_BASE_INTERNAL_UNSCALEDCYCLECLOCK_CONFIG_H_ 0017 0018 #if defined(__APPLE__) 0019 #include <TargetConditionals.h> 0020 #endif 0021 0022 // The following platforms have an implementation of a hardware counter. 0023 #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \ 0024 defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \ 0025 defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC)) 0026 #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1 0027 #else 0028 #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 0 0029 #endif 0030 0031 // The following platforms often disable access to the hardware 0032 // counter (through a sandbox) even if the underlying hardware has a 0033 // usable counter. The CycleTimer interface also requires a *scaled* 0034 // CycleClock that runs at atleast 1 MHz. We've found some Android 0035 // ARM64 devices where this is not the case, so we disable it by 0036 // default on Android ARM64. 0037 #if defined(__native_client__) || (defined(__APPLE__)) || \ 0038 (defined(__ANDROID__) && defined(__aarch64__)) 0039 #define ABSL_USE_UNSCALED_CYCLECLOCK_DEFAULT 0 0040 #else 0041 #define ABSL_USE_UNSCALED_CYCLECLOCK_DEFAULT 1 0042 #endif 0043 0044 // UnscaledCycleClock is an optional internal feature. 0045 // Use "#if ABSL_USE_UNSCALED_CYCLECLOCK" to test for its presence. 0046 // Can be overridden at compile-time via -DABSL_USE_UNSCALED_CYCLECLOCK=0|1 0047 #if !defined(ABSL_USE_UNSCALED_CYCLECLOCK) 0048 #define ABSL_USE_UNSCALED_CYCLECLOCK \ 0049 (ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION && \ 0050 ABSL_USE_UNSCALED_CYCLECLOCK_DEFAULT) 0051 #endif 0052 0053 #if ABSL_USE_UNSCALED_CYCLECLOCK 0054 // This macro can be used to test if UnscaledCycleClock::Frequency() 0055 // is NominalCPUFrequency() on a particular platform. 0056 #if (defined(__i386__) || defined(__x86_64__) || defined(__riscv) || \ 0057 defined(_M_IX86) || defined(_M_X64)) 0058 #define ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY 0059 #endif 0060 #endif 0061 0062 #endif // ABSL_BASE_INTERNAL_UNSCALEDCYCLECLOCK_CONFIG_H_
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |