Getting Tracing data via the Chrome Debugging Protocol

702 views
Skip to first unread message

Giang Nguyen

unread,
Jul 13, 2016, 7:22:45 PM7/13/16
to chromium-dev
(Sorry--copied from chromium-discuss list, which seems to be having issues)

Hi,

I am using Chromium 38.0.2125.122 and want to know when blink is running JavaScript (e.g., running a script, calling a function scheduled by setTimeout, etc.)---specifically, when blink is in a V8RecursionScope. I see that Tracing can provide this information.

Now, I am trying to get the Tracing data via the Chrome Debugging Protocol version 1.1 [1]. I can issue Tracing.start (and Tracing.end) but have not been able to get any Tracing.dataCollected event.

Suggestions?
Thanks,

Below I try to eliminate other potential issues:

First, when launching Chromium with --trace-to-console=v8 and loading my simple test page, I can see:

[... trace_event_impl.cc :1996] CrRendererMain: v8.run[v8], {fileName:"http://.../script.js"}
[... trace_event_impl.cc :1996] CrRendererMain: | V8.Execute[v8]
.
.
.
[... trace_event_impl.cc :1996] CrRendererMain: | V8.Execute[v8] (7.847 ms)
[... trace_event_impl.cc :1996] CrRendererMain: v8.run[v8], {fileName:"http://.../script.js"} (8.419 ms)


Then, my python client implementing the Chrome Debugging Protocol works fine: I can issue Page.navigate and get Network.requestWillBeSent and Page.loadEventFired events, etc..

When I issue Tracing.start with "categories": "v8", I get back an error:

{'code': -32602, 'message': "Some arguments of method 'Tracing.start' can't be processed", 'data': ["Parameter 'options' with type 'String' was not found."]}

which I get around by also specifying "options": "" or "record-until-full", etc.

[1] https://chromedevtools.github.io/debugger-protocol-viewer/1-1/

Andrey Kosyakov

unread,
Jul 13, 2016, 10:39:19 PM7/13/16
to cau...@gmail.com, chromium-dev
First, you might want to experiment against a recent canary, dev channel or at least a stable release -- DevTools protocol is rapidly evolving, and developing against an older version might bring some unwanted surprises later, and getting the docs matching an older version might be challenging. 

Other than this, please note that you will only get Tracing.dataCollected events _after_ Tracing.end is issued, and that you need to specify both "categories" and "options".

If this still does not help, you can try sniffing the way DevTools do this to get an example:
- open DevTools;
- open DevTools on DevTools by undocking the former and pressing Ctrl+Shift+I again;
- evaluate InspectorBackendClass.Options.dumpInspectorProtocolMessages = true in the second instance of DevTools (this command is for the modern version, the older version that you use has a different way of enabling this);
- start/stop Timeline in the first instance;
- observe protocol messages in the console of the second instance.

Best regards,
Andrey.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Giang Nguyen

unread,
Jul 14, 2016, 3:47:45 PM7/14/16
to Chromium-dev, cau...@gmail.com
Thanks, Andrey. I didn't have to sniff DevTools as you suggested. Your hint that Tracing.dataCollected are fired _after_ Tracing.end prompted me to look closer at my code, and it was a bug on my end.
Reply all
Reply to author
Forward
0 new messages