New issue
Advanced search Search tips

Issue 861782 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Profiling (simpleperf) doesn't work with Monochrome

Project Member Reported by skyos...@chromium.org, Jul 9

Issue description

To reproduce:

1. Set up a build with the following gn args:

  target_cpu = "arm"                                                                                                                                                                                                                                                           
  target_os = "android"                                                                                                                                                                                                                                                        
  is_debug = false                                                                                                                                                                                                                                                             
  is_official_build = true                                                                                                                                                                                                                                                       
  is_chrome_branded = true                                                                                                                                                                                                                                                       
  symbol_level = 1                                                                                                                                                                                                                                                             
  use_signing_keys = true                                                                                                                                                                                                                                                      
  proprietary_codecs = true                                                                                                                                                                                                                                                    
  ffmpeg_branding = "Chrome"    

2. Build and install Monochrome:

  $ ninja -j 2000 -l 20 -C out/Default monochrome_apk
  $ out/Default/bin/monochrome_apk run

3. Start profiling:

  $ out/Default/bin/monochrome_apk profile
Profiler is running; press Enter to stop...simpleperf W environment.cpp:446] Sample frequency 4000 is out of range [1, 3300], adjust it to 3300
simpleperf E process.cpp:40] failed to open /proc/3184: No such file or directory
simpleperf I event_selection_set.cpp:773] Cpu 3 is offlined
simpleperf I event_selection_set.cpp:785] Cpu 3 is onlined
simpleperf I event_selection_set.cpp:773] Cpu 3 is offlined
simpleperf I event_selection_set.cpp:773] Cpu 2 is offlined

Post-processing data...simpleperf W dso.cpp:265] failed to read min virtual address of /data/app/com.google.android.apps.chrome-RiSTRV7HGV8CqpOm77gqEw==/base.apk!/lib/armeabi-v7a/libmonochrome.so: File not found
simpleperf W dso.cpp:360] /data/app/com.google.android.apps.chrome-RiSTRV7HGV8CqpOm77gqEw==/base.apk!/lib/armeabi-v7a/libmonochrome.so doesn't contain symbol table
simpleperf W dso.cpp:363] failed to read symbols from [wlan_drv_gen2]: File not found
simpleperf W dso.cpp:265] failed to read min virtual address of unknown: File not found
simpleperf W dso.cpp:363] failed to read symbols from unknown: File not found
simpleperf W dso.cpp:265] failed to read min virtual address of /dev/ashmem/dalvik-jit-code-cache: File not found
simpleperf W dso.cpp:363] failed to read symbols from /dev/ashmem/dalvik-jit-code-cache: File not found
simpleperf W dso.cpp:265] failed to read min virtual address of /dev/ashmem/dalvik-jit-code-cache (deleted): File not found
simpleperf W dso.cpp:363] failed to read symbols from /dev/ashmem/dalvik-jit-code-cache (deleted): File not found
simpleperf W dso.cpp:360] /data/app/com.google.android.apps.chrome-RiSTRV7HGV8CqpOm77gqEw==/oat/arm/base.odex doesn't contain symbol table
simpleperf I cmd_record.cpp:427] Samples recorded: 5204. Samples lost: 5575.
simpleperf W cmd_record.cpp:434] Lost 51.7209% of samples, consider increasing mmap_pages(-m), or decreasing sample frequency(-f), or increasing sample period(-c).

Profile data written to profile.pb.

In the resulting profile, samples for Chrome get attributed clustered into one [libmonochrome.so] symbol.
 
What version of Android is on the device?
This is a Nokia TA-1060 running Android 8.1.0.
I haven't been able to reproduce this on a Nexus 5X running 8.1.0.

From the warning messages, it looks like a problem with the simpleperf binary running on the device. I've never encountered a problem like that before, so I'm at a bit of a loss.

The profiling code installs a pre-built simpleperf binary onto the device, taken from this directory in your chromium checkout:

src/third_party/android_ndk/simpleperf/bin/android/

... and installs it into this directory on the device:

/data/local/tmp/profilers/

Maybe you can try running simpleperf directly via `adb shell`, and see if it works?
Thanks for looking into this! I just gave this another try and I'm still seeing the original errors[1]. Simpleperf seems to be running fine, but the generated reported profile (attached) still seems to collapse many (but not all!) of the libmonochrome.so samples into a single [libmonochrome.so] entry. The seemingly working symbols seem to be a little suspicious too, e.g., blink::protocol::Emulation::DispatcherImpl::setUserAgentOverride shows up high even though I haven't attached DevTools to the renderer.

I suspect something is going a little funky with the symbolization. I've attached the perf.data file from this run too. I noticed third_party/android_ndk/simpleperf/pprof_proto_generator.py (actually libsimpleperf_report.so) tries to do something special for libraries that follow the base.apk!... pattern above -- maybe we aren't generating the sysroot correctly for that to work?

[1] Slight caveat: I had to edit a few of the script to insert "su 0" in front of a few of the commands since this device doesn't quite support "adb root".
profile.pb
794 KB Download
perf.data
373 KB Download

Sign in to add a comment