Commit 800404b5 authored by Oystein Eftevaag's avatar Oystein Eftevaag Committed by Commit Bot

Added a README for the Chrome Perfetto integration

R=primiano@chromium.org

No-Try: true
Change-Id: Ia6642d8576939ba28492ddada335bb10e77e802f
Reviewed-on: https://chromium-review.googlesource.com/1031516
Commit-Queue: oysteine <oysteine@chromium.org>
Reviewed-by: default avatarPrimiano Tucci <primiano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554872}
parent cacba2dc
# Perfetto in Chrome
[TOC]
## Overview
Perfetto is a project intended to provide a common platform for performance
instrumentation and logging across Chrome and Android, and this directory
contains the code integrating the Perfetto library into Chrome. Specifically
it provides a Mojo-based transportation layer which any individual new data source can
build on to send logging protos to Perfetto, and an implementation which lets
`about://tracing` generate a Chrome Tracing trace (`TRACE_EVENT0`, etc) using
Perfetto rather than `/base/trace_event/trace_log.cc` as a backend.
The library itself lives in [AOSP](https://android.googlesource.com/platform/external/perfetto/)
and is rolled in [/third_party/chrome/](https://cs.chromium.org/chromium/src/third_party/perfetto/).
## Perfetto Documentation
[Project page](https://android.googlesource.com/platform/external/perfetto/+/master/README.md)
[Life of a Perfetto tracing Session](https://android.googlesource.com/platform/external/perfetto/+/master/docs/life-of-a-tracing-session.md)
[Internal documentation](http://go/perfetto-project)
## Directory Structure
```
//services/tracing/ <-- Perfetto is embedded by the tracing service
/perfetto/ <-- Internal service implementation code
/public/
/cpp/perfetto <-- C++ client libraries used by the data source providers.
/mojom/ <-- Mojom interfaces
//third_party/perfetto/ <-- DEPS-rolled external library
```
## Adding a new data source
A data source is a provider of a specific type of data in the form of protobufs,
like Chrome Trace Events, memory-infra memory dumps, netlog, etc. It registers itself
with Perfetto with a given string identifier (e.g. `org.chromium.trace-event`) and if enabled
by the central Perfetto service, writes its protos into the provided Perfetto TraceWriter(s).
These data source providers can live in any child process, and the Mojo transportation layer
will take care of the details of passing them to the central service through shared memory
buffers.
To add a new data source:
* Add a new string identifier in [perfetto_service.mojom](/services/tracing/public/mojom/perfetto_service.mojom).
* Register the data source in [ProducerHost::OnConnect](/services/tracing/perfetto/producer_host.cc).
* Set up the data source in [ProducerClient::CreateDataSourceInstance](/services/tracing/public/cpp/perfetto/producer_client.cc).
* Tear down the data source in [ProducerClient::TearDownDataSourceInstance](/services/tracing/public/cpp/perfetto/producer_client.cc).
* For each thread that wants to log a proto, use a separate TraceWriter created using
[ProducerClient::CreateTraceWriter](/services/tracing/public/cpp/perfetto/producer_client.cc).
## Contact
For any questions about Perfetto in Chrome or adding a new data source, please
start a thread on [tracing@chromium.org](https://groups.google.com/a/chromium.org/forum/#!forum/tracing).
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment