Implement Chrome flags that allows collecting trace in userland |
||||||
Issue description
This is so that we can get tracing data in webkit performance tests. Launching chrome with --enable-javascript-tracing-api will enable APIs to start & stop tracing.
I propose the tracing APIs as follows:
1) windows.tracing_controller.startTracing(categories, callback);
callback is invoked when the start tracing operation succeeds or fails. Callback receives no arguments. If the operation fails, windows.tracing_controller.lastError will be set to the error message.
2)
windows.tracing_controller.collectTraceChunkAsStream(callback);
callback is invoked with params, which is:
params: {
'traceChunk': '....', // a string that represent a trace chunk.
'eof': .. // a boolean indicate whether this is end of the trace file
}
To collect the next trace chunk, one will invoke collectTraceChunkAsStream until 'eof' is true.
When there is error, params will be undefined & windows.tracing_controller.lastError will be set to the error message
Zhen, Andrey, Primiano: thoughts on this API?
,
Mar 13 2017
Or, if really B, caseq : is there a way to expose the web tools websocket to js? I would like to avoid exposing yet another tracing API endpoint unless we really really need it
,
Mar 14 2017
,
Mar 14 2017
To #1: it's B. The idea is we want to get trace within Javascript context in a page. We need this so that performance tests in https://cs.chromium.org/chromium/src/third_party/WebKit/PerformanceTests/ can also use trace data for detailed breakdown (see design doc in https://docs.google.com/document/d/1feawFQpadFCcXEsVqz9z7ucSBIQBgFc23z873g69rKc/edit)
,
Mar 14 2017
,
Mar 16 2017
So we're talking of tests that run in content_shell, right? We already expose TestRunner::ShowWebInspector (https://cs.chromium.org/chromium/src/content/shell/test_runner/test_runner.cc?rcl=6810f4a0e51ff154c73f1540772f8b65ce117acd&l=616) which in theory should be sufficient for what you're trying to do. This is how DevTools' layout tests work BTW.
,
Mar 16 2017
caseq@: interesting! However, I would want to apply this for all chromium build, because we also run these tests in non content_shell.
,
Mar 16 2017
Do we need to be able to start and stop tracing from JS, or do we just need a way to record a trace per page visited?
,
Mar 16 2017
To #8: we need to be able to start & stop tracing from JS, because the code that compute metrics based on trace will be part of the JS test. This is so that people can just open test pages in webkit/PerformanceTests/.. in browser (with flag) & see results right on the page.
,
Mar 16 2017
,
Mar 16 2017
Ned, is running with --disable-web-security an option? If that's the case I just realized you can just talk to devtools from within JS by just running chrome with: --remote-debugging-port=5555 --disable-web-security And then using a WebSocket on ws://localhost:5555 The websocket will allow to start/stop tracing and get the json back.
,
Mar 16 2017
Running with "--disable-web-security" seems like an option to me. Though requiring users to also specify the devtool debugging port seems a bit inconvenient. +esprehn@: thoughts?
,
Mar 16 2017
> Though requiring users to also specify the devtool debugging port seems a bit inconvenient. Can we just make a fixed choice in the test runner and hence, just tell people: the "official" devtools port for perf tests is 1234. hopefully that would be just a constant somewhere, right?
,
Mar 16 2017
Specifying a fixed port has the risk of the port already been used. It's not a big problem for local workflow but a big one for bots, so we use ephemeral port in Telemetry. I wonder if we can make "--disable-web-security" also expose the devtool port number in somethings like "chrome.devtool_port".
,
Jul 25 2017
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by primiano@chromium.org
, Mar 13 2017