tag | 5b7b7ab79514c140c4115c82354311171fcc6a4e | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Mon May 03 15:05:46 2021 -0700 |
object | 2e369efc3f37932d3b1f78d8076961b82753fb0d |
Android 11.0.0 Release 36 (RQ2A.210505.002)
commit | 2e369efc3f37932d3b1f78d8076961b82753fb0d | [log] [tgz] |
---|---|---|
author | Miao Wang <miaowang@google.com> | Fri Jun 26 05:40:25 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Jun 26 05:40:25 2020 +0000 |
tree | 09b0ac6b537b142cbbe0c4e29bfa82a7ddc9cbe0 | |
parent | 31c3fa2003d5ed1669b62ee71bb14af4a6f99acb [diff] | |
parent | d24ff61ddffe3e7da04de5b970a8c434efd17faf [diff] |
Add -mcpu=generic to arm32 build target am: b6d99557be am: d24ff61ddf Original change: https://googleplex-android-review.googlesource.com/c/platform/external/cpuinfo/+/12004395 Change-Id: Ieaf8ab98381a2fca62b80803b3d4bda4a996baa9
cpuinfo is a library to detect essential for performance optimization information about host CPU.
Log processor name:
cpuinfo_initialize(); printf("Running on %s CPU\n", cpuinfo_get_package(0)->name);
Detect if target is a 32-bit or 64-bit ARM system:
#if CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 /* 32-bit ARM-specific code here */ #endif
Check if the host CPU support ARM NEON
cpuinfo_initialize(); if (cpuinfo_has_arm_neon()) { neon_implementation(arguments); }
Check if the host CPU supports x86 AVX
cpuinfo_initialize(); if (cpuinfo_has_x86_avx()) { avx_implementation(arguments); }
Check if the thread runs on a Cortex-A53 core
cpuinfo_initialize(); switch (cpuinfo_get_current_core()->uarch) { case cpuinfo_uarch_cortex_a53: cortex_a53_implementation(arguments); break; default: generic_implementation(arguments); break; }
Get the size of level 1 data cache on the fastest core in the processor (e.g. big core in big.LITTLE ARM systems):
cpuinfo_initialize(); const size_t l1_size = cpuinfo_get_processor(0)->cache.l1d->size;
Pin thread to cores sharing L2 cache with the current core (Linux or Android)
cpuinfo_initialize(); cpu_set_t cpu_set; CPU_ZERO(&cpu_set); const struct cpuinfo_cache* current_l2 = cpuinfo_get_current_processor()->cache.l2; for (uint32_t i = 0; i < current_l2->processor_count; i++) { CPU_SET(cpuinfo_get_processor(current_l2->processor_start + i)->linux_id, &cpu_set); } pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpu_set);
/proc/cpuinfo
on ARMro.chipname
, ro.board.platform
, ro.product.board
, ro.mediatek.platform
, ro.arch
properties (Android)dmesg
) on ARM Linux/proc/cpuinfo
on 32-bit ARM EABI (Linux)FPSID
and WCID
registers (32-bit ARM)getauxval
(Linux/ARM)/proc/self/auxv
(Android/ARM)/proc/cpuinfo
(Linux/pre-ARMv7)sysctlbyname
(Mach)typology
directories (ARM/Linux)cache
directories (Linux)/proc/cpuinfo
(Linux)host_info
(Mach)GetLogicalProcessorInformationEx
(Windows)