What steps will reproduce the problem? 1.Run the application "dalvik explorer" on a dual core phone 2.observe the result. 3.note that twin dd if=/dev/zero of=/dev/null in a shell changes(corrects) the result.
What is the expected output? Manufacturer: motorola Model: MB865 CPU ABI: armeabi-v7a Cores: 2
What do you see instead? Manufacturer: motorola Model: MB865 CPU ABI: armeabi-v7a Cores: 1
What version of the product are you using? On what operating system? Same result on Samsung/SGH-I897/SGH-I897 and this Moto Atrix. +++++++++++++++++++++++++++++ android.vm.dexfile=true file.encoding=UTF-8 file.separator=/ http.agent=Dalvik/1.4.0 (Linux; U; Android 2.3.6; MB865 Build/5.5.1-175_EDMR1.25) java.boot.class.path=/system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar java.class.path=. java.class.version=46.0 java.compiler=
++++++++++++++++++++++++++++++++++++ Manufacturer: motorola Model: MB865
CPU ABI: armeabi-v7a Cores: 1
Brand: MOTO Board: p3 Device: edison
Build Fingerprint: MOTO/edison_att_us/edison:2.3.6/5.5.1-175_EDMR1.25/5.51.175.25:user/release-keys
DalvikVM Heap Size: 42 MiB
Screen Density: 240dpi (1.5x DIP) Screen Size: 540 x 960 pixels Exact DPI: 254.0 x 256.67368 Approximate Dimensions: 2.1" x 3.7" (4.3" diagonal)
Features: android.hardware.wifi android.hardware.location.network android.hardware.telephony android.hardware.location
Please provide any additional information below. Running two coppies of: dd if=/dev/zero of=/dev/null changes the result to the expected two cores.
A better call than "Runtime.getRuntime().availableProcessors()" might help or perhaps the base libraries under this call could be improved.
Comment #1
Posted on May 31, 2012 by Swift Hipposysconf _SC_PROCESSORS_ONLN was broken in bionic until some time in 2010, which probably means Gingerbread was broken. I'll reimplement it in Java in Dalvik Explorer so we can support old builds better.
Comment #2
Posted on May 31, 2012 by Swift Hippofixed by revision 562 (version 2.6).
Comment #3
Posted on May 31, 2012 by Swift Hippo(let me know if that fixes things for you.)
Comment #4
Posted on May 31, 2012 by Massive HippoNot quite. I will grab /proc/cpuinfo and /proc/stat for you.
On my two phones what I now see is: ++++++++++++++++++ My Samsung. http.agent=Dalvik/1.4.0 (Linux; U; Android 2.3.5; SAMSUNG-SGH-I897 Build/GINGERBREAD) shows..... Manufacturer: SAMSUNG Model: SAMSUNG-SGH-I897
CPU ABI: armeabi-v7a Cores: 0 (enabled: 1) +++++++++++++++++++++++++++++++++++ My Motorola phone is unchanged: http.agent=Dalvik/1.4.0 (Linux; U; Android 2.3.6; MB865 Build/5.5.1-175_EDMR1.25) Manufacturer: motorola Model: MB865 CPU ABI: armeabi-v7a Cores: 1 Brand: MOTO Board: p3 Device: edison Build Fingerprint: MOTO/edison_att_us/edison:2.3.6/5.5.1-175_EDMR1.25/5.51.175.25:user/release-keys ++++++++++++++++++++++ When this is done: It might also be valuable to put a header on the report with a date:time and DalvikExplorer version and perhaps something unique about the phone so in a week or a month the data could be sorted out. The verson has double value in that it lets you know what version of DE is running as well as it permits someone to parse the file should the format change in the future. Right now I believe that DE did up-date on the Moto phone but since it acts exactly the same (dd trick changes Cores count) I will have to double check.
Thanks, mitch
Comment #5
Posted on May 31, 2012 by Massive HippoFor the Samsung phone. /proc/stat and /proc/cpuinfo $ cat /proc/stat cpu 593950 37287 330868 2264692 129664 98 23759 0 0 0 cpu0 593950 37287 330868 2264692 129664 98 23759 0 0 0 intr 21969188 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1083 0 0 0 1083 0 0 0 3412 0 7 0 2574 0 0 0 0 0 0 0 1 5 0 0 0 42 0 0 0 3 0 0 0 0 988011 0 0 0 0 0 159 0 0 6585414 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 148779 0 0 0 0 1 0 9962191 3240635 94150 0 0 0 0 384400 0 0 0 0 7389 0 0 0 147529 0 0 0 7565 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 377418 3 39 2 0 28 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15797 0 0 0 0 0 0 0 0 0 0 0 0 1083 0 0 0 0 0 0 0 0 0 0 0 0 385 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ctxt 46800737 btime 1338463260 processes 37335 procs_running 2 procs_blocked 0 softirq 16530820 0 2824421 1 574294 0 0 12495175 0 6918 630011 $ cat /proc/cpuinfo Processor : ARMv7 Processor rev 2 (v7l) BogoMIPS : 996.00 Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc08 CPU revision : 2
Hardware : herring Revision : 0030 Serial : 3332cfba413300ec
Comment #6
Posted on May 31, 2012 by Swift Hippothe internet implies that part 0xc08 is an OMAP3430, which is single-core, so i think Dalvik Explorer and the Linux kernel are in agreement here, and correct. (i wish i had a canonical list of ARM cpuid part numbers. why isn't there a wikipedia page for that?)
so i think this is a Nexus S (or similar), which was single core. oh, but you're saying i report 0? oops. i'll have to test on a single-core phone. i only tested on >= 2, stupidly. yeah, judging by your output it looks like the SMP kernel's output is different; the uniprocessor kernel doesn't output the "processor" lines; just a single "Processor" line. which is also there in the SMP output, but needs to be ignored. ugh.
i'll look at fixing this tonight if i get time. i like your version number idea too.
Comment #7
Posted on May 31, 2012 by Massive HippoThe below update is info from my Atrix2 which has two cores.
Update: DalvikExp 2.6 thinks this Atrix2 has 1 core.which switches to 2 cores with a dd if=/dev/zero of=/dev/null running.
The root of the problem may be that /proc/stat also changes so it may be that the OS shuts down the second core and there is no easy way to know short of a look up table by cpu type which will not tell you if the OS will ever light it up again. Perhaps report "Currently Active Cores"
ATRIX....MB865 processor is TI OMAP4430 and Moto has a big old "Dual core" splash screen at startup $ cat /proc/stat cpu 448442 40045 198354 6469762 107462 25 3847 0 0 0 cpu0 405103 34002 183907 2987157 100389 25 3632 0 0 0 intr 5537088 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 466482 119311 0 0 0 0 0 0 0 0 544776 0 0 0 136916 78721 0 0 0 0 0 0 0 0 0 0 404025 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 412321 0 0 901 747754 397 0 0 1 452569 0 0 0 0 5193 0 0 7661 167946 5 234 0 0 0 0 0 0 0 0 0 21158 0 0 1283241 0 0 0 0 0 0 0 285738 0 0 0 0 127681 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26249 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 191184 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 17670 0 0 0 0 0 38939 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ctxt 27963118 btime 1338330310 processes 46635 procs_running 2 procs_blocked 0 softirq 3147469 175426 1509764 2043 247347 1848 1848 90087 96816 2716 1019574
$cat /proc/cpuinfo Processor : ARMv7 Processor rev 3 (v7l) processor : 0 BogoMIPS: 1996.68
Features: swp half thumb fastmult vfp edsp thumbee neon vfpv3 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x1 CPU part: 0xc09 CPU revision : 3
Hardware: mapphone_UMTS Revision: 0000 Serial : 0000000000000000 $ Atrix
Comment #8
Posted on May 31, 2012 by Swift Hippoodd. my expectation was that you'd get "Cores: 2 (enabled: 1)" in cases like this.
i'd be curious to see "ls -l /sys/devices/system/cpu" in a case like this. (also "ls -l /sys/devices/system/cpu/cpu*".)
(i don't actually have any hardware that shuts cores down myself.)
Comment #9
Posted on May 31, 2012 by Massive HippoHmm... I am not sure they do shut down... This is on the Motorola Atrix2... $ ls -l /sys/devices/system/cpu -r--r--r-- root root 4096 2012-05-31 16:39 online -r--r--r-- root root 4096 2012-05-31 16:39 possible -r--r--r-- root root 4096 2012-05-31 16:39 present -r--r--r-- root root 4096 2012-05-31 16:39 kernel_max -r--r--r-- root root 4096 2012-05-31 16:39 offline drwxr-xr-x root root 2012-05-31 16:39 cpufreq drwxr-xr-x root root 2012-05-31 16:39 cpuidle drwxr-xr-x root root 2012-05-31 15:57 cpu0 drwxr-xr-x root root 2012-05-31 16:39 cpu1 app_152@edison:/$
...............DE version 2.6............ Build/Device Details
Manufacturer: motorola Model: MB865
CPU ABI: armeabi-v7a Cores: 1
Brand: MOTO Board: p3 Device: edison
Build Fingerprint: MOTO/edison_att_us/edison:2.3.6/5.5.1-175_EDMR1.25/5.51.175.25:user/release-keys
DalvikVM Heap Size: 42 MiB
Screen Density: 240dpi (1.5x DIP) Screen Size: 540 x 960 pixels Exact DPI: 254.0 x 256.67368 Approximate Dimensions: 2.1" x 3.7" (4.3" diagonal)
Features: android.hardware.wifi android.hardware.location.network android.hardware.telephony android.hardware.location android.hardware.touchscreen.multitouch android.hardware.sensor.compass android.hardware.camera android.hardware.bluetooth android.hardware.touchscreen.multitouch.distinct android.hardware.sensor.proximity android.hardware.microphone android.hardware.sensor.light android.hardware.location.gps com.motorola.vpn.cisco android.hardware.camera.autofocus android.hardware.telephony.gsm android.hardware.camera.front android.hardware.sensor.accelerometer android.software.live_wallpaper android.hardware.touchscreen android.hardware.camera.flash
OpenGL ES version: 2.0
DalvikVM features: method-trace-profiling method-trace-profiling-streaming hprof-heap-dump hprof-heap-dump-streaming
Shared Java libraries: com.motorola.android.telephony android.test.runner com.motorola.blur.library.service com.motorola.blur.library.messaging com.motorola.android.storage com.cequint.platform.1.4.75 com.motorola.vpn.ext com.motorola.blur.library.image com.motorola.android.datamanager.base com.motorola.android.customization com.scalado.caps jcifs-krb5-1.3.12 com.motorola.blur.library.utilities com.android.location.provider com.motorola.android.imirrorservice com.motorola.android.camera javax.obex com.motorola.android.iextdispservice com.motorola.android.mobad
..................
$ ls -l /sys/devices/system/cpu/cpu* -rw-r--r-- root root 4096 2012-05-31 16:47 online drwxr-xr-x root root 2012-05-31 16:47 topology drwxr-xr-x root root 2012-05-31 16:47 cpuidle drwxr-xr-x root root 2012-05-31 15:57 cpufreq -rw-r--r-- root root 4096 2012-05-31 16:47 online drwxr-xr-x root root 2012-05-31 16:47 cpuidle drwxr-xr-x root root 2012-05-31 16:47 mot_hotplug -r--r--r-- root root 4096 2012-05-31 16:47 current_driver -r--r--r-- root root 4096 2012-05-31 16:47 current_governor_ro app_152@edison:/$
Comment #10
Posted on Jun 1, 2012 by Swift Hippowhy don't you think they shut down? i think that's exactly what's going on. (i think that's what the mot_hotplug stuff is all about, and why /proc/stat and /proc/cpuinfo don't match /sys/devices/system/cpu.)
could you show the content of the cpu0 and cpu1 directories separately? i forgot about the cpufreq and cpuidle directories. could you also cat the "online" files in those directories? i'm assuming they say "1" and "0" when one core is asleep, and "1" and "1" when they're both up.
Comment #11
Posted on Jun 1, 2012 by Massive HippoYou could be correct... it can be easy to explore
sure... and one better I hope. I can run modest shell scripts like this for you:
!/system/bin/sh
set -x cat /proc/stat echo =========================================== cat /proc/cpuinfo echo =========================================== ls -lR /sys/devices/system/cpu echo =========================================== ls -l /sys/devices/system/cpu/cpu0 echo =========================================== ls -l /sys/devices/system/cpu/cpu1
sleep 2 dd if=/dev/zero of=/dev/null &
cat /proc/stat echo =========================================== cat /proc/cpuinfo echo =========================================== ls -lR /sys/devices/system/cpu echo =========================================== ls -l /sys/devices/system/cpu/cpu0 echo =========================================== ls -l /sys/devices/system/cpu/cpu1
sleep 2 kill %1 +++++++++++++++++++++++++++++++++++++++++++++++ The above results in: $ sh < tinker
- cat /proc/stat cpu 29470 7289 16968 363032 19300 3 169 0 0 0 cpu0 23678 5075 14313 170267 15318 3 137 0 0 0 intr 560568 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25788 928 0 0 0 0 0 0 0 0 65551 0 0 0 11468 5 0 0 0 0 0 0 0 0 0 0 28526 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 34654 0 0 248 95688 397 0 0 1 7624 0 0 0 0 400 0 0 4785 21927 77 0 0 0 0 0 0 0 0 0 0 18754 0 0 211764 0 0 0 0 0 2721 3308 6672 0 0 0 0 3396 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2522 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6408 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 3148 0 0 0 0 0 3793 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ctxt 2320618 btime 1338504921 processes 6108 procs_running 1 procs_blocked 0 softirq 265746 22490 110674 141 9637 129 129 7428 11633 172 103313
+ echo ===========================================
- cat /proc/cpuinfo Processor : ARMv7 Processor rev 3 (v7l) processor : 0 BogoMIPS : 1996.68
Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x1 CPU part : 0xc09 CPU revision : 3
Hardware : mapphone_UMTS Revision : 0000 Serial : 0000000000000000
+ echo ===========================================
- ls -lR /sys/devices/system/cpu -lR: No such file or directory online possible present kernel_max offline cpufreq cpuidle cpu0 cpu1
+ echo ===========================================
- ls -l /sys/devices/system/cpu/cpu0 -rw-r--r-- root root 4096 2012-05-31 17:40 online drwxr-xr-x root root 2012-05-31 17:40 topology drwxr-xr-x root root 2012-05-31 17:40 cpuidle drwxr-xr-x root root 2012-05-31 17:38 cpufreq
+ echo ===========================================
ls -l /sys/devices/system/cpu/cpu1 -rw-r--r-- root root 4096 2012-05-31 17:40 online drwxr-xr-x root root 2012-05-31 17:40 cpuidle
sleep 2
dd if=/dev/zero of=/dev/null
cat /proc/stat cpu 29475 7289 16977 363226 19300 3 169 0 0 0 cpu0 23682 5075 14321 170461 15318 3 137 0 0 0 intr 560847 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25798 928 0 0 0 0 0 0 0 0 65586 0 0 0 11478 5 0 0 0 0 0 0 0 0 0 0 28559 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 34682 0 0 248 95804 397 0 0 1 7624 0 0 0 0 400 0 0 4785 21927 77 0 0 0 0 0 0 0 0 0 0 18754 0 0 211788 0 0 0 0 0 2726 3313 6674 0 0 0 0 3396 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2525 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6410 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 3154 0 0 0 0 0 3793 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ctxt 2321432 btime 1338504921 processes 6115 procs_running 3 procs_blocked 0 softirq 265827 22490 110713 141 9637 129 129 7428 11633 172 103355
+ echo ===========================================
- cat /proc/cpuinfo Processor : ARMv7 Processor rev 3 (v7l) processor : 0 BogoMIPS : 598.90
Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x1 CPU part : 0xc09 CPU revision : 3
Hardware : mapphone_UMTS Revision : 0000 Serial : 0000000000000000
+ echo ===========================================
- ls -lR /sys/devices/system/cpu -lR: No such file or directory online possible present kernel_max offline cpufreq cpuidle cpu0 cpu1
+ echo ===========================================
- ls -l /sys/devices/system/cpu/cpu0 -rw-r--r-- root root 4096 2012-05-31 17:40 online drwxr-xr-x root root 2012-05-31 17:40 topology drwxr-xr-x root root 2012-05-31 17:40 cpuidle drwxr-xr-x root root 2012-05-31 17:38 cpufreq
+ echo ===========================================
ls -l /sys/devices/system/cpu/cpu1 -rw-r--r-- root root 4096 2012-05-31 17:40 online drwxr-xr-x root root 2012-05-31 17:40 cpuidle
sleep 2
kill %1 [1] Terminated sh
Comment #12
Posted on Jun 1, 2012 by Swift Hippomanually taking processors offline, i see that x86 and ARM kernels differ. on ARM, offline processors go missing from both /proc files, so we can't use /proc for _SC_NPROCESSORS_CONF. (this means bionic's still broken. i'll have to fix that.)
revision 565 switches to using /sys/devices/system/cpu/ for the total (not online) CPUs. glibc does that. interestingly, it uses both /sys/devices/system/cpu/online and /proc/stat for the online processors. i'm not sure why, but since both seem to work fine, i'll stick with /proc/stat for now since it's easier.
Comment #13
Posted on Jun 1, 2012 by Swift Hippo(for the record, 0xc08 just means Cortex-A8, not specifically an OMAP.)
Comment #14
Posted on Jun 1, 2012 by Swift Hippookay, should be fixed in version 2.7, which also decodes some of the /proc/cpuinfo stuff.
Comment #15
Posted on Jun 1, 2012 by Massive HippoThank you!
Comment #16
Posted on Jun 6, 2012 by Swift Hippoalso fixed in bionic: https://android-review.googlesource.com/37568
Status: Fixed
Labels:
Type-Defect
Priority-Medium