Simpleperf cpu-cycles not supported in Android devices - android

I'm trying to make profiling with simpleperf in my Android ndk application but when I type simpleperf record command, the system reports this message:
simpleperf E 02-08 13:34:47 15380 15380 event_selection_set.cpp:68]
Event type 'cpu-cycles' is not supported by the kernel
I read this tutorial: https://android.googlesource.com/platform/system/extras/+/master/simpleperf/README.md
and I followed these steps:
Make android debuggable=true in the manifest.
adb shell setprop security.perf_harden 0
adb shell
shell#mako: run-as com.mysample.test
adb push bin/android/arm/simpleperf /data/local/tmp
shell#mako: cp /data/local/tmp/simpleperf .
shell#mako: ./simpleperf record -p 12083 --duration 30
Is that means that the nexus 4 cpu-cycles are not supported in the hardware or may i have not activated a specific security flag on the kernel?
I am using rooted nexus 4 device.
Ndk version 13b.
Android version: 5.1
Kernel version: 3.4.0-perf-gf75bb4f
pd: I tagged perf tag because of the similarity with perf.
Thanks in advance.
Unai.

Nexus 4 supports cpu-cycles event. I can't find the kernel version f75bb4f in git history, so I didn't test the same kernel. I have tested by flashing 5.1.1 (LMY48T) on nexus 4, using simpleperf in ndk-r13b, and it works. So I suspect the kernel you use disables perf events, and you can fix this by flashing a new image in https://developers.google.com/android/images#occam.

Related

How can I enable cpu, memory, and io in cgroupv2 (attempt to run Docker on Android)

I am trying to run Docker on Android, using a Pixel 3a XL rooted, running stock rom but flashed a custom kernel. I need to enable cpu, cpuset, memory, io, and pid controllers in cgroupv2. After enabling them in menuconfig and flashing the kernel, the script used to check shows only pid available under cgroupv2 controllers.
What do I need to do besides enabling these options in the kernel’s menuconfig? Did I maybe not enable all the necessary options?
If I run
cat /sys/fs/cgroup/cgroup.controllers
it only returns "pids".
With the current state, when I run docker I get a warning for each item,
WARN: Unable to find cpu controller”
and
error setting cgroup config for procHooks process: bpf_prog_query(BPF_CGROUP_DEVICE)
As I understand it, these options may be mounted with cgroupv1 and this is why they do not show up?
I am using this guide: https://gist.github.com/FreddieOliveira/efe850df7ff3951cb62d74bd770dce27
and these are the options I enabled in my kernel using menuconfig: https://wiki.gentoo.org/wiki/Docker
From the config I flashed in my kernel:
CONFIG_CGROUPS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_CPUACCT=y
I flash the kernel by flashing the Image.lz4-dtb file that is created after building the kernel.
Here is a photo after running the script to check if kernel options are all enabled. Am trying to change these from missing to available/enabled.
photo
The solution was to run: sudo mount -t tmpfs cgroup_root /sys/fs/cgroup which created directories for each of the cgroup resources and allowed Docker to run.
Useful is section 2.1:
https://android.googlesource.com/kernel/common/+/android-trusty-3.10/Documentation/cgroups/cgroups.txt

Can't connect to i.MX7 via fastboot

I have an IMX7 board from TechNexion. This is the board linked from the Android Things website as a supported board. On unboxing the board, I cannot connect to the device via Fastboot. I can access the boot prompt and default/shipped linux installation via a serial connection. It also connects via ethernet. But no Fastboot. I'd like to install the latest Android Things OS.
fastboot devices returns nothing. adb devices returns nothing. Rebooting adb has no impact. I've also tried starting Fastboot from the U-Boot prompt.
=> fastboot
Unknown command 'fastboot' - try 'help'
The documentation implies it's installed on the device.
I'm running the latest Android platform tools (26.0.0) on a Mac (10.12.6).
I don't have much experience with Fastboot or hardware, but I have connected to a few other boards without any problem. Any ideas appreciated.
EDIT: below is the output as seen from the serial connection. This is the bootloader output, and then also the initial part of the Linux boot sequence.
MMC: FSL_SDHC: 0, FSL_SDHC: 1
No panel detected: default to MCIMX28LCD
Display: MCIMX28LCD (800x480)
Video: 800x480x24
In: serial
Out: serial
Err: serial
switch to partitions #0, OK
mmc1(part 0) is current device
Net: FEC0
Warning: FEC0 MAC addresses don't match:
Address in SROM is 00:1f:7b:86:2e:3f
Address in environment is 00:1f:7b:aa:01:32
Normal Boot
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc1(part 0) is current device
switch to partitions #0, OK
mmc1(part 0) is current device
reading boot.scr
** Unable to read file boot.scr **
reading zImage
5726824 bytes read in 149 ms (36.7 MiB/s)
Booting from mmc ...
reading imx7d-pico_pi.dtb
44004 bytes read in 17 ms (2.5 MiB/s)
Kernel image # 0x80800000 [ 0x000000 - 0x576268 ]
## Flattened Device Tree blob at 83000000
Booting using the fdt blob at 0x83000000
Using Device Tree in place at 83000000, end 8300dbe3
Starting kernel ...
Booting Linux on physical CPU 0x0
Linux version 4.1.15-224683-gf3ba9d9 (tapani#triceratops) (gcc version 5.1.1 20150608 (Linaro GCC 5.1-2015.08) ) #4 SMP PREEMPT Tue Dec 20 17:50:41 HKT 2016
It looks like your board was not shipped with the fastboot bootloader necessary for Android Things, and instead has been pre-flashed with a Linux distro.
You will need to use the mfgtools package from NXP to re-flash your board with the proper bootloader to continue. The NXP Pico Quick Start Guide for Android Things describes where to get this tool (section 7.3) and how to use it to re-flash the bootloader with mfgtools (section 9.1).
After the bootloader has been updated, you should be able to follow the official flashing instructions to install Android Things using an image downloaded from the console.
Maybe try:
adb kill-server
It helped here Android Things - pico i.mx7 unable to connect

find android ABI value

I'm trying to debug an android application that a user has reported a particular problem with. I have created a virtual device but when it comes to the ABI version I'm lost as how to find out the version the mobile is using (if the mobile even uses this!).
(it doesn't help that I don't really know what this means / is used for)
Is there a way to find if the devices is using (armabi-v7a, x86, x86_64, x86(googleAPIs).
Any help is appreciated.
As stated in Determining Supported Processor Types (ABIs) for an Android Device:
Pre-Lollipop: From terminal type adb shell getprop ro.product.cpu.abi
Lollipop and higher: From terminal type adb shell getprop ro.product.cpu.abilist

Android 4.4 Nexus 4 — rild.* section is missing in build.prop

On Nexus S (2.3 vanilla):
$ adb shell cat /system/build.prop | grep rild
rild.libpath=/vendor/lib/libsec-ril.so
rild.libargs=-d /dev/ttyS0
On Nexus 4 (4.4 vanilla):
$ adb shell cat /system/build.prop | grep rild
$
This prop present on all my Android phones: Samsung Galaxy Trend (4.1), Alcatel One Touch Pixie (2.3), Motorola Moto G (4.3), but is missing on Nexus 4.
Full build.prop:
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=KOT49H
ro.build.display.id=KOT49H
ro.build.version.incremental=937116
ro.build.version.sdk=19
ro.build.version.codename=REL
ro.build.version.release=4.4.2
ro.build.date=Wed Dec 4 23:40:01 UTC 2013
ro.build.date.utc=1386200401
ro.build.type=user
ro.build.user=android-build
ro.build.host=kpfj3.cbf.corp.google.com
ro.build.tags=release-keys
ro.product.model=Nexus 4
ro.product.brand=google
ro.product.name=occam
ro.product.device=mako
ro.product.board=MAKO
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.product.manufacturer=LGE
ro.product.locale.language=en
ro.product.locale.region=US
ro.wifi.channels=
ro.board.platform=msm8960
# ro.build.product is obsolete; use ro.product.device
ro.build.product=mako
# Do not try to parse ro.build.description or .fingerprint
ro.build.description=occam-user 4.4.2 KOT49H 937116 release-keys
ro.build.fingerprint=google/occam/mako:4.4.2/KOT49H/937116:user/release-keys
ro.build.characteristics=nosdcard
# end build properties
#
# ADDITIONAL_BUILD_PROPERTIES
#
ro.config.ringtone=Themos.ogg
ro.config.notification_sound=Tejat.ogg
ro.config.alarm_alert=Oxygen.ogg
ro.com.android.dateformat=MM-dd-yyyy
ro.com.android.dataroaming=false
ro.url.legal=http://www.google.com/intl/%s/mobile/android/basic/phone-legal.html
ro.url.legal.android_privacy=http://www.google.com/intl/%s/mobile/android/basic/privacy.html
ro.com.google.clientidbase=android-google
ro.carrier=unknown
ro.com.android.wifi-watchlist=GoogleGuest
ro.error.receiver.system.apps=com.google.android.gms
ro.setupwizard.enterprise_mode=1
ro.opengles.version=196608
ro.sf.lcd_density=320
persist.audio.handset.mic.type=digital
persist.audio.dualmic.config=endfire
persist.audio.fluence.voicecall=true
persist.audio.handset.mic=dmic
persist.audio.fluence.mode=endfire
persist.audio.lowlatency.rec=false
af.resampler.quality=4
persist.radio.apm_sim_not_pwdn=1
ro.telephony.call_ring.multiple=0
persist.hwc.mdpcomp.enable=true
ro.qualcomm.bt.hci_transport=smd
telephony.lteOnCdmaDevice=0
drm.service.enabled=true
wifi.interface=wlan0
wifi.supplicant_scan_interval=15
media.aac_51_output_enabled=true
debug.egl.recordable.rgba8888=1
ro.qc.sensors.wl_dis=true
ro.qualcomm.sensors.smd=true
dalvik.vm.heapstartsize=8m
dalvik.vm.heapgrowthlimit=192m
dalvik.vm.heapsize=512m
dalvik.vm.heaptargetutilization=0.75
dalvik.vm.heapminfree=512k
dalvik.vm.heapmaxfree=8m
keyguard.no_require_sim=true
ro.facelock.black_timeout=400
ro.facelock.det_timeout=1500
ro.facelock.rec_timeout=2500
ro.facelock.lively_timeout=2500
ro.facelock.est_max_time=600
ro.facelock.use_intro_anim=false
persist.sys.dalvik.vm.lib=libdvm.so
dalvik.vm.dexopt-flags=m=y
net.bt.name=Android
dalvik.vm.stack-trace-file=/data/anr/traces.txt
The first question: is this "feature" of Nexus 4 only or whole Android 4.4?
The second question: how should I determine the radio interface location in this case?
Android Phones regardless of Model or maker all have Build.Prop files. The Build.Prop File is used to determine phone functionality and setting information based on installed hardware and software. Carrier and Phone Build.Prop file will vary from phone to phone and could even further be augmented by the use of Custom Roms.
A Simple way to dump your build.prop file for a android device with ADB(Android Debug Bridge) would be to run the line below assuming you have ADB installed which it looks like you do.
adb shell getprop > "%USERPROFILE%\Desktop\prop.txt"
This run in a command prompt will tell ADB to drop a file name prop.text file with the key/Value pair of the given device to your desktop. I like to use GetProp because it lays out your keys and values in a format that is easier to read.
As for your Question regarding the Radio Interface Location. You will have to be more specific. What Radio are you referring to? Cellular, Bluetooth or Wifi?
The answer in general could be that the maker of that phone did not create the key with a similar name and instead is using another format for identifying it. Also keep in mind that your older phones are running a older Android OS and the key your referring to could be a obsolete.
What key are you specifically looking for currently?

Getting Android SDK version of a device from command line

I'm planning to build an automated system for deploying an Android build to various devices, in order to make development for multiple platforms a bit more comfortable. Is there a way to get the sdk version of a connected device through android shell or adb?
There will be a computer to which several test devices is connected, and I was planning to write a script which will fetch the correct build for each of those from a build-server, install the different apks on their respective devices, launch them and collect log info, to be made available through some other program whose specifications are beside the point.
The point is that I need to know the sdk version each device is running to install the correct apk, and I was hoping I could get this through adb, but I can't seem to find a way to access it short of building a tiny app, compatible with all versions, whose sole purpose would be to output android.os.Build.VERSION.SDK or similar somewhere my script could read it.
you can use this command:
adb shell grep ro.build.version.sdk= system/build.prop
It will output something like this:
ro.build.version.sdk=10
adb shell getprop ro.build.version.sdk
Note #Tim: this works even on phones without grep support on all host OS :-). (i.e. on old phones where toolbox does not support grep you you need to have busybox on your phone).
I also discovered a way to get the exact version of Android e.g. 4.2.2 based on the following web article http://xayon.net/looking-for-android-version-with-adb/ You need to be using a unix-like operating system - Linux and Mac OSX are fine, and windows users can use cygwin or equivalent.
At a command line:
echo version=$(adb shell getprop |awk -F":" '/build.version.release/ { print $2 }')|tr -d '[]'
Here is the result for my Nexus 4:
version= 4.2.2
I think you can by accessing the device with adb shell - change directories to position you at system and do a cat of build.prop. Here you will find for instance, ro.build.description=google_sdk-eng 2.2, ro.build.version.release=2.2 etc

Categories

Resources