New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 686238 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Need an easy way to start and stop tracing on Android

Project Member Reported by mariakho...@chromium.org, Jan 27 2017

Issue description

Support the following workflow on Android

Start tracing
Take a memory dump
... do stuff ..
Take another memory dump
Stop tracing

Primiano said he has details on how this can be done today. We should also discuss UI affordance to be able to do this without crazy hacks.
 
Cc: hjd@chromium.org
+hjd in case he has some some spare cycles to hack this up

Yup this should be easily scriptable:
1. run chrome with --enable-heap-profiling --enable-remote-debugging
this will cause chrome to start the devtools debugger on "localabstract:chrome_devtools_remote" (which is a named UNIX socket)
2. adb forward tcp:1234 localabstract:chrome_devtools_remote
 1234 is a random numbeer. This will setup tcp forwarding from the Linux Desktop machine to the UNIX socket. So by conencting to localhost:1234 you will now talk to the devtools backend on Chrome for Android.

At this point you can talk the devtools protocol websocket. i didn't have any time today, but there should be python examples around.
What you want to do is reaching the Tracing.Start, Tracing.Stop and Tracing.requestMemoryDump endpoints (see protocol.json and the doc here https://chromedevtools.github.io/debugger-protocol-viewer/tot/Tracing/)

I am bit rushing today, but once I have some more time I can try myself some websocket code. 
It should be a matter of building 3 JSON requests for start, requestdump and stop.
Or eventually, might be easier to reuse the python telemetry code from 
https://cs.chromium.org/chromium/src/third_party/catapult/telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend.py?q=requestmemorydum+f:%5C.py&sq=package:chromium&l=201&dr=C

Done
https://gist.github.com/primiano/4aea6a36f2d209ad09bc509c9b9defc3

If anybody has spare cycles we should check it in catapult/tracing/bin

Tested on OSX:
------
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --remote-debugging-port=9222

$ python ~/code/tracing-devtools.py --port 9222 -o ~/Downloads/trace.json
Connecting to ws://localhost:9222/devtools/browser
Starting trace with trace_config {'excludedCategories': ['*'], 'memoryDumpConfig': {'triggers': []}, 'includedCategories': ['disabled-by-default-memory-infra']}
Requesting memory dump
Flushing trace

/Users/primiano/Downloads/trace.json: 1451 KB
------

should work on android using the steps described in #1 

Comment 3 by hjd@chromium.org, Jan 31 2017

Cc: primiano@chromium.org
Owner: hjd@chromium.org
I've prepared a CL with that gist, just testing now.
Project Member

Comment 4 by bugdroid1@chromium.org, Feb 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2826081823ca2c2cb5c04697f4402051ab19b8df

commit 2826081823ca2c2cb5c04697f4402051ab19b8df
Author: catapult-deps-roller <catapult-deps-roller@chromium.org>
Date: Mon Feb 06 18:24:05 2017

Roll src/third_party/catapult/ e1e303241..71633f4c8 (1 commit).

https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git/+log/e1e303241a39..71633f4c8c3f

$ git log e1e303241..71633f4c8 --date=short --no-merges --format='%ad %ae %s'
2017-02-06 hjd [tracing] Add memory_infra_dump_devtools script

BUG= 686238 

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, see:
http://www.chromium.org/developers/tree-sheriffs/sheriff-details-chromium#TOC-Failures-due-to-DEPS-rolls

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel
TBR=catapult-sheriff@chromium.org

Review-Url: https://codereview.chromium.org/2678783004
Cr-Commit-Position: refs/heads/master@{#448312}

[modify] https://crrev.com/2826081823ca2c2cb5c04697f4402051ab19b8df/DEPS

Comment 5 by hjd@chromium.org, Feb 6 2017

Status: Fixed (was: Assigned)
Done! Primiano's script now lives at tracing/bin/memory_infra_remote_dump

Sign in to add a comment