【发布时间】:2015-06-13 13:41:18
【问题描述】:
在我的应用中,我从 Build.CPU_ABI 检查 CPU,如果 CPU 是 X86,请用户下载捆绑了 X86 库的正确包。
但是今天我得到了一个带有 Intel CPU 的 Asus Fonepad 7,但令人惊讶的是,Build.CPU_ABI 是 armeabi-v7a 而不是 X86 .我在某处读到,因为许多开发人员没有在他们的应用程序中捆绑 X86 本机库,所以华硕使用了 ARM-X86 翻译器,因此该应用程序认为是在 Arm 设备上运行.更令人惊讶的是,即使捆绑了 X86 库,它仍然会加载 Arm 库。
我相信代码翻译会显着降低性能。那么有什么方法可以确定真正的 CPU 拱门吗?然后强制加载 X86 库而不是 Arm?
-------- 编辑 --------
当我从包中删除 armeabi-v7a 文件夹时,**Build.CPU_ABI 变为 X86,现在它会加载 X86 代码。**
我查看了 /proc/cpuinfo,唯一清楚的是它包含一个 Intel CPU。如果 cpuinfo 中出现 intel 字样,那么将 CPU 视为 X86 是否安全?
唯一的选择是拥有两个不同的 APK,一个用于 arm,另一个用于 X86。因为如果所有二进制文件都在同一个 APK 文件中,无论如何都会加载 Arm 二进制文件!
这是/proc/cpuinfo的内容:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 90
model name : Genuine Intel(R) CPU 4000 @ 1.00GHz
stepping : 0
microcode : 0x27
cpu MHz : 1833.000
cache size : 1024 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand lahf_lm 3dnowprefetch ida arat epb dtherm tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms
bogomips : 1996.80
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 90
model name : Genuine Intel(R) CPU 4000 @ 1.00GHz
stepping : 0
microcode : 0x27
cpu MHz : 1833.000
cache size : 1024 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 4
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand lahf_lm 3dnowprefetch ida arat epb dtherm tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms
bogomips : 1996.80
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 90
model name : Genuine Intel(R) CPU 4000 @ 1.00GHz
stepping : 0
microcode : 0x27
cpu MHz : 1833.000
cache size : 1024 KB
physical id : 0
siblings : 4
core id : 2
cpu cores : 4
apicid : 4
initial apicid : 4
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand lahf_lm 3dnowprefetch ida arat epb dtherm tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms
bogomips : 1996.80
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 90
model name : Genuine Intel(R) CPU 4000 @ 1.00GHz
stepping : 0
microcode : 0x27
cpu MHz : 1833.000
cache size : 1024 KB
physical id : 0
siblings : 4
core id : 3
cpu cores : 4
apicid : 6
initial apicid : 6
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand lahf_lm 3dnowprefetch ida arat epb dtherm tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms
bogomips : 1996.80
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
【问题讨论】:
标签: android android-ndk