|
Add tracing service and make the shell+sky_viewer+services talk to it
This adds a tracing service that can aggregate tracing data from
multiple sources and write a json file out to disk that trace-viewer can
understand. This also teaches the shell, sky_viewer, and various other
services how to register themselves with the tracing service and provide
tracing data on demand. Finally, this teaches the skydb prompt to tell
the tracing service to start/stop tracing when the 'trace' command is
issued.
The tracing service exposes two APIs, a collector interface and a
coordinator interface. The collector interface allows different entities
to register themselves as being capable of producing tracing data. The
coordinator interface allows asking the service to collect data from
all registered sources and flushing the collected data to disk.
The service keeps track of all open connections to registered sources
and broadcasts a request for data whenever the coordinator's Start
method is called, then aggregates all data send back into a single
trace file. In this patch, the tracing service simply gives all sources
1 second to return data then flushes to disk. Ideally it would keep
track of how many requests it sent out and give each source a certain
amount of time to respond but this is simple and works for most cases.
The tracing service can talk to any source that is capable of producing
data that the trace-viewer can handle, which is a broad set, but in
practice many programs will want to use //base/debug's tracing to
produce trace data. This adds code at //mojo/common:tracing_impl that
registers a collector hooked up to //base/debug's tracing system. This
can be dropped in to the mojo::ApplicationDelegate::Initialize()
implementation for most services and applications to easily enable
base tracing. Programs that don't use //base, or that want to register
additional data sources that can talk to trace viewer (perhaps providing
data that's more easily available from another thread, say) may want
to create additional connections to the tracing service.
R=eseidel@chromium.org
Committed: https://chromium.googlesource.com/external/mojo/+/85ccf05073474c97e09c6729b2307cebac45b162
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+303 lines, -99 lines) |
Patch |
 |
M |
mojo/common/BUILD.gn
|
View
|
|
1 chunk |
+2 lines, -5 lines |
0 comments
|
Download
|
 |
M |
mojo/common/DEPS
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
D |
mojo/common/tracing.mojom
|
View
|
|
1 chunk |
+0 lines, -10 lines |
0 comments
|
Download
|
 |
M |
mojo/common/tracing_impl.h
|
View
|
|
1 chunk |
+25 lines, -9 lines |
0 comments
|
Download
|
 |
M |
mojo/common/tracing_impl.cc
|
View
|
|
1 chunk |
+34 lines, -44 lines |
0 comments
|
Download
|
 |
M |
mojo/services/native_viewport/BUILD.gn
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/services/native_viewport/main.cc
|
View
|
|
2 chunks |
+3 lines, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/services/surfaces/BUILD.gn
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/services/surfaces/surfaces_service_application.h
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/services/surfaces/surfaces_service_application.cc
|
View
|
|
2 chunks |
+5 lines, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/services/view_manager/BUILD.gn
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/services/view_manager/view_manager_app.h
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/services/view_manager/view_manager_app.cc
|
View
|
|
2 chunks |
+5 lines, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/services/window_manager/BUILD.gn
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/services/window_manager/main.cc
|
View
|
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/shell/BUILD.gn
|
View
|
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/shell/DEPS
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
mojo/shell/context.cc
|
View
|
|
3 chunks |
+8 lines, -0 lines |
0 comments
|
Download
|
 |
M |
services/BUILD.gn
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
A + |
services/tracing/BUILD.gn
|
View
|
|
1 chunk |
+7 lines, -16 lines |
0 comments
|
Download
|
 |
A |
services/tracing/main.cc
|
View
|
|
1 chunk |
+88 lines, -0 lines |
0 comments
|
Download
|
 |
A |
services/tracing/trace_data_sink.h
|
View
|
|
1 chunk |
+31 lines, -0 lines |
0 comments
|
Download
|
 |
A |
services/tracing/trace_data_sink.cc
|
View
|
|
1 chunk |
+41 lines, -0 lines |
0 comments
|
Download
|
 |
A |
services/tracing/tracing.mojom
|
View
|
|
1 chunk |
+31 lines, -0 lines |
0 comments
|
Download
|
 |
M |
sky/tools/debugger/prompt/BUILD.gn
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
sky/tools/debugger/prompt/prompt.cc
|
View
|
|
3 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
 |
M |
sky/viewer/viewer.cc
|
View
|
|
3 chunks |
+3 lines, -9 lines |
0 comments
|
Download
|
Total messages: 4 (1 generated)
|