Merge "wattson: Fix estimates when entire CPU track missing" into main
diff --git a/Android.bp b/Android.bp
index 69c599d..fa82c12 100644
--- a/Android.bp
+++ b/Android.bp
@@ -5481,6 +5481,7 @@
"protos/perfetto/metrics/chrome/dropped_frames.proto",
"protos/perfetto/metrics/chrome/frame_times.proto",
"protos/perfetto/metrics/chrome/histogram_hashes.proto",
+ "protos/perfetto/metrics/chrome/histogram_summaries.proto",
"protos/perfetto/metrics/chrome/long_latency.proto",
"protos/perfetto/metrics/chrome/media_metric.proto",
"protos/perfetto/metrics/chrome/performance_mark_hashes.proto",
@@ -6790,6 +6791,7 @@
"protos/perfetto/trace/ftrace/fastrpc.proto",
"protos/perfetto/trace/ftrace/fence.proto",
"protos/perfetto/trace/ftrace/filemap.proto",
+ "protos/perfetto/trace/ftrace/fs.proto",
"protos/perfetto/trace/ftrace/ftrace.proto",
"protos/perfetto/trace/ftrace/ftrace_event.proto",
"protos/perfetto/trace/ftrace/ftrace_event_bundle.proto",
@@ -7220,6 +7222,7 @@
"protos/perfetto/trace/ftrace/fastrpc.proto",
"protos/perfetto/trace/ftrace/fence.proto",
"protos/perfetto/trace/ftrace/filemap.proto",
+ "protos/perfetto/trace/ftrace/fs.proto",
"protos/perfetto/trace/ftrace/ftrace.proto",
"protos/perfetto/trace/ftrace/ftrace_event.proto",
"protos/perfetto/trace/ftrace/ftrace_event_bundle.proto",
@@ -7312,6 +7315,7 @@
"external/perfetto/protos/perfetto/trace/ftrace/fastrpc.gen.cc",
"external/perfetto/protos/perfetto/trace/ftrace/fence.gen.cc",
"external/perfetto/protos/perfetto/trace/ftrace/filemap.gen.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/fs.gen.cc",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace.gen.cc",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event.gen.cc",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event_bundle.gen.cc",
@@ -7404,6 +7408,7 @@
"external/perfetto/protos/perfetto/trace/ftrace/fastrpc.gen.h",
"external/perfetto/protos/perfetto/trace/ftrace/fence.gen.h",
"external/perfetto/protos/perfetto/trace/ftrace/filemap.gen.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/fs.gen.h",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace.gen.h",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event.gen.h",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event_bundle.gen.h",
@@ -7492,6 +7497,7 @@
"protos/perfetto/trace/ftrace/fastrpc.proto",
"protos/perfetto/trace/ftrace/fence.proto",
"protos/perfetto/trace/ftrace/filemap.proto",
+ "protos/perfetto/trace/ftrace/fs.proto",
"protos/perfetto/trace/ftrace/ftrace.proto",
"protos/perfetto/trace/ftrace/ftrace_event.proto",
"protos/perfetto/trace/ftrace/ftrace_event_bundle.proto",
@@ -7583,6 +7589,7 @@
"external/perfetto/protos/perfetto/trace/ftrace/fastrpc.pb.cc",
"external/perfetto/protos/perfetto/trace/ftrace/fence.pb.cc",
"external/perfetto/protos/perfetto/trace/ftrace/filemap.pb.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/fs.pb.cc",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace.pb.cc",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event.pb.cc",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event_bundle.pb.cc",
@@ -7674,6 +7681,7 @@
"external/perfetto/protos/perfetto/trace/ftrace/fastrpc.pb.h",
"external/perfetto/protos/perfetto/trace/ftrace/fence.pb.h",
"external/perfetto/protos/perfetto/trace/ftrace/filemap.pb.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/fs.pb.h",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace.pb.h",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event.pb.h",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event_bundle.pb.h",
@@ -7762,6 +7770,7 @@
"protos/perfetto/trace/ftrace/fastrpc.proto",
"protos/perfetto/trace/ftrace/fence.proto",
"protos/perfetto/trace/ftrace/filemap.proto",
+ "protos/perfetto/trace/ftrace/fs.proto",
"protos/perfetto/trace/ftrace/ftrace.proto",
"protos/perfetto/trace/ftrace/ftrace_event.proto",
"protos/perfetto/trace/ftrace/ftrace_event_bundle.proto",
@@ -7854,6 +7863,7 @@
"external/perfetto/protos/perfetto/trace/ftrace/fastrpc.pbzero.cc",
"external/perfetto/protos/perfetto/trace/ftrace/fence.pbzero.cc",
"external/perfetto/protos/perfetto/trace/ftrace/filemap.pbzero.cc",
+ "external/perfetto/protos/perfetto/trace/ftrace/fs.pbzero.cc",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace.pbzero.cc",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event.pbzero.cc",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event_bundle.pbzero.cc",
@@ -7946,6 +7956,7 @@
"external/perfetto/protos/perfetto/trace/ftrace/fastrpc.pbzero.h",
"external/perfetto/protos/perfetto/trace/ftrace/fence.pbzero.h",
"external/perfetto/protos/perfetto/trace/ftrace/filemap.pbzero.h",
+ "external/perfetto/protos/perfetto/trace/ftrace/fs.pbzero.h",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace.pbzero.h",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event.pbzero.h",
"external/perfetto/protos/perfetto/trace/ftrace/ftrace_event_bundle.pbzero.h",
@@ -13224,6 +13235,7 @@
"src/trace_processor/metrics/sql/chrome/chrome_args_class_names.sql",
"src/trace_processor/metrics/sql/chrome/chrome_event_metadata.sql",
"src/trace_processor/metrics/sql/chrome/chrome_histogram_hashes.sql",
+ "src/trace_processor/metrics/sql/chrome/chrome_histogram_summaries.sql",
"src/trace_processor/metrics/sql/chrome/chrome_input_to_browser_intervals.sql",
"src/trace_processor/metrics/sql/chrome/chrome_input_to_browser_intervals_base.sql",
"src/trace_processor/metrics/sql/chrome/chrome_input_to_browser_intervals_template.sql",
@@ -13642,6 +13654,7 @@
"src/trace_processor/perfetto_sql/stdlib/prelude/after_eof/views.sql",
"src/trace_processor/perfetto_sql/stdlib/prelude/before_eof/tables.sql",
"src/trace_processor/perfetto_sql/stdlib/prelude/before_eof/trace_bounds.sql",
+ "src/trace_processor/perfetto_sql/stdlib/sched/latency.sql",
"src/trace_processor/perfetto_sql/stdlib/sched/runnable.sql",
"src/trace_processor/perfetto_sql/stdlib/sched/states.sql",
"src/trace_processor/perfetto_sql/stdlib/sched/thread_executing_span.sql",
@@ -15152,6 +15165,7 @@
"protos/perfetto/trace/ftrace/fastrpc.proto",
"protos/perfetto/trace/ftrace/fence.proto",
"protos/perfetto/trace/ftrace/filemap.proto",
+ "protos/perfetto/trace/ftrace/fs.proto",
"protos/perfetto/trace/ftrace/ftrace.proto",
"protos/perfetto/trace/ftrace/ftrace_event.proto",
"protos/perfetto/trace/ftrace/ftrace_event_bundle.proto",
@@ -16493,6 +16507,7 @@
"protos/perfetto/trace/ftrace/fastrpc.proto",
"protos/perfetto/trace/ftrace/fence.proto",
"protos/perfetto/trace/ftrace/filemap.proto",
+ "protos/perfetto/trace/ftrace/fs.proto",
"protos/perfetto/trace/ftrace/ftrace.proto",
"protos/perfetto/trace/ftrace/ftrace_event.proto",
"protos/perfetto/trace/ftrace/ftrace_event_bundle.proto",
@@ -17064,6 +17079,11 @@
cflags: [
"-DZLIB_IMPLEMENTATION",
],
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.profiling",
+ ],
+ min_sdk_version: "35",
}
// GN: //src/traceconv:traceconv
diff --git a/BUILD b/BUILD
index d4f1f1b..64c1e49 100644
--- a/BUILD
+++ b/BUILD
@@ -2541,6 +2541,7 @@
"src/trace_processor/metrics/sql/chrome/chrome_args_class_names.sql",
"src/trace_processor/metrics/sql/chrome/chrome_event_metadata.sql",
"src/trace_processor/metrics/sql/chrome/chrome_histogram_hashes.sql",
+ "src/trace_processor/metrics/sql/chrome/chrome_histogram_summaries.sql",
"src/trace_processor/metrics/sql/chrome/chrome_input_to_browser_intervals.sql",
"src/trace_processor/metrics/sql/chrome/chrome_input_to_browser_intervals_base.sql",
"src/trace_processor/metrics/sql/chrome/chrome_input_to_browser_intervals_template.sql",
@@ -3166,6 +3167,7 @@
perfetto_filegroup(
name = "src_trace_processor_perfetto_sql_stdlib_sched_sched",
srcs = [
+ "src/trace_processor/perfetto_sql/stdlib/sched/latency.sql",
"src/trace_processor/perfetto_sql/stdlib/sched/runnable.sql",
"src/trace_processor/perfetto_sql/stdlib/sched/states.sql",
"src/trace_processor/perfetto_sql/stdlib/sched/thread_executing_span.sql",
@@ -5230,6 +5232,7 @@
"protos/perfetto/metrics/chrome/dropped_frames.proto",
"protos/perfetto/metrics/chrome/frame_times.proto",
"protos/perfetto/metrics/chrome/histogram_hashes.proto",
+ "protos/perfetto/metrics/chrome/histogram_summaries.proto",
"protos/perfetto/metrics/chrome/long_latency.proto",
"protos/perfetto/metrics/chrome/media_metric.proto",
"protos/perfetto/metrics/chrome/performance_mark_hashes.proto",
@@ -5625,6 +5628,7 @@
"protos/perfetto/trace/ftrace/fastrpc.proto",
"protos/perfetto/trace/ftrace/fence.proto",
"protos/perfetto/trace/ftrace/filemap.proto",
+ "protos/perfetto/trace/ftrace/fs.proto",
"protos/perfetto/trace/ftrace/ftrace.proto",
"protos/perfetto/trace/ftrace/ftrace_event.proto",
"protos/perfetto/trace/ftrace/ftrace_event_bundle.proto",
diff --git a/DIR_METADATA b/DIR_METADATA
index 592fce2..6c28780 100644
--- a/DIR_METADATA
+++ b/DIR_METADATA
@@ -2,3 +2,6 @@
component: "Speed>Tracing"
}
team_email: "tracing@chromium.org"
+buganizer_public: {
+ component_id: 1457213
+}
diff --git a/docs/concepts/config.md b/docs/concepts/config.md
index c4326e6..1badce4 100644
--- a/docs/concepts/config.md
+++ b/docs/concepts/config.md
@@ -4,11 +4,12 @@
in Perfetto all tracing data sources are idle by default and record data only
when instructed to do so.
-Data sources record data only when one (or more) tracing sessions are active.
-A tracing session is started by invoking the `perfetto` cmdline client and
-passing a config (see QuickStart guide for
+Data sources record data only when one (or more) tracing sessions are active. A
+tracing session is started by invoking the `perfetto` cmdline client and passing
+a config (see QuickStart guide for
[Android](/docs/quickstart/android-tracing.md),
-[Linux](/docs/quickstart/linux-tracing.md), or [Chrome on desktop](/docs/quickstart/chrome-tracing.md)).
+[Linux](/docs/quickstart/linux-tracing.md), or
+[Chrome on desktop](/docs/quickstart/chrome-tracing.md)).
A simple trace config looks like this:
@@ -31,7 +32,7 @@
}
}
-````
+```
And is used as follows:
@@ -43,7 +44,7 @@
[`/test/configs/`](/test/configs/).
NOTE: If you are tracing on Android using adb and experiencing problems, see
- [the Android section](#android) below.
+[the Android section](#android) below.
## TraceConfig
@@ -51,38 +52,40 @@
([reference docs](/docs/reference/trace-config-proto.autogen)) that defines:
1. The general behavior of the whole tracing system, e.g.:
- * The max duration of the trace.
- * The number of in-memory buffers and their size.
- * The max size of the output trace file.
+
+ - The max duration of the trace.
+ - The number of in-memory buffers and their size.
+ - The max size of the output trace file.
2. Which data sources to enable and their configuration, e.g.:
- * For the [kernel tracing data source](/docs/data-sources/cpu-scheduling.md)
- , which ftrace events to enable.
- * For the [heap profiler](/docs/data-sources/native-heap-profiler.md), the
- target process name and sampling rate.
-
- See the _data sources_ section of the docs for details on how to
- configure the data sources bundled with Perfetto.
-3. The `{data source} x {buffer}` mappings: which buffer each data
- source should write into (see [buffers section](#buffers) below).
+ - For the [kernel tracing data source](/docs/data-sources/cpu-scheduling.md)
+ , which ftrace events to enable.
+ - For the [heap profiler](/docs/data-sources/native-heap-profiler.md), the
+ target process name and sampling rate.
-The tracing service (`traced`) acts as a configuration dispatcher: it receives
-a config from the `perfetto` cmdline client (or any other
+ See the _data sources_ section of the docs for details on how to configure
+ the data sources bundled with Perfetto.
+
+3. The `{data source} x {buffer}` mappings: which buffer each data source should
+ write into (see [buffers section](#buffers) below).
+
+The tracing service (`traced`) acts as a configuration dispatcher: it receives a
+config from the `perfetto` cmdline client (or any other
[Consumer](/docs/concepts/service-model.md#consumer)) and forwards parts of the
config to the various [Producers](/docs/concepts/service-model.md#producer)
connected.
When a tracing session is started by a consumer, the tracing service will:
-* Read the outer section of the TraceConfig (e.g. `duration_ms`, `buffers`) and
+- Read the outer section of the TraceConfig (e.g. `duration_ms`, `buffers`) and
use that to determine its own behavior.
-* Read the list of data sources in the `data_sources` section. For each data
+- Read the list of data sources in the `data_sources` section. For each data
source listed in the config, if a corresponding name (`"linux.ftrace"` in the
example below) was registered, the service will ask the producer process to
- start that data source, passing it the raw bytes of the
- [`DataSourceConfig` subsection][dss] verbatim to the data source (See
- backward/forward compat section below).
+ start that data source, passing it the raw bytes of the [`DataSourceConfig`
+ subsection][dss] verbatim to the data source (See backward/forward compat
+ section below).
![TraceConfig diagram](/docs/images/trace_config.png)
@@ -109,10 +112,10 @@
Each buffer has a fill policy which is either:
-* RING_BUFFER (default): the buffer behaves like a ring buffer and writes when
+- RING_BUFFER (default): the buffer behaves like a ring buffer and writes when
full will wrap over and replace the oldest trace data in the buffer.
-* DISCARD: the buffer stops accepting data once full. Further write attempts are
+- DISCARD: the buffer stops accepting data once full. Further write attempts are
dropped.
WARNING: DISCARD can have unexpected side-effect with data sources that commit
@@ -121,36 +124,34 @@
A trace config must define at least one buffer to be valid. In the simplest case
all data sources will write their trace data into the same buffer.
- While this is
-fine for most basic cases, it can be problematic in cases where different data
-sources write at significantly different rates.
+While this is fine for most basic cases, it can be problematic in cases where
+different data sources write at significantly different rates.
For instance, imagine a trace config that enables both:
-1. The kernel scheduler tracer. On a typical Android phone this records
- ~10000 events/second, writing ~1 MB/s of trace data into the buffer.
+1. The kernel scheduler tracer. On a typical Android phone this records ~10000
+ events/second, writing ~1 MB/s of trace data into the buffer.
2. Memory stat polling. This data source writes the contents of /proc/meminfo
- into the trace buffer and is configured to poll every 5 seconds, writing
- ~100 KB per poll interval.
+ into the trace buffer and is configured to poll every 5 seconds, writing ~100
+ KB per poll interval.
If both data sources are configured to write into the same buffer and such
buffer is set to 4MB, most traces will contain only one memory snapshot. There
are very good chances that most traces won't contain any memory snapshot at all,
-even if the 2nd data sources was working perfectly.
-This is because during the 5 s. polling interval, the scheduler data source can
-end up filling the whole buffer, pushing the memory snapshot data out of the
-buffer.
+even if the 2nd data sources was working perfectly. This is because during the 5
+s. polling interval, the scheduler data source can end up filling the whole
+buffer, pushing the memory snapshot data out of the buffer.
## Dynamic buffer mapping
-Data-source <> buffer mappings are dynamic in Perfetto.
-In the simplest case a tracing session can define only one buffer. By default,
-all data sources will record data into that one buffer.
+Data-source <> buffer mappings are dynamic in Perfetto. In the simplest case a
+tracing session can define only one buffer. By default, all data sources will
+record data into that one buffer.
In cases like the example above, it might be preferable separating these data
-sources into different buffers.
-This can be achieved with the `target_buffer` field of the TraceConfig.
+sources into different buffers. This can be achieved with the `target_buffer`
+field of the TraceConfig.
![Buffer mapping](/docs/images/trace_config_buffer_mapping.png)
@@ -189,11 +190,11 @@
#### Text format
-It is the preferred format for human-driven workflows and exploration. It
-allows to pass directly the text file in the PBTX (ProtoBuf TeXtual
-representation) syntax, for the schema defined in the
-[trace_config.proto](/protos/perfetto/config/trace_config.proto)
-(see [reference docs](/docs/reference/trace-config-proto.autogen))
+It is the preferred format for human-driven workflows and exploration. It allows
+to pass directly the text file in the PBTX (ProtoBuf TeXtual representation)
+syntax, for the schema defined in the
+[trace_config.proto](/protos/perfetto/config/trace_config.proto) (see
+[reference docs](/docs/reference/trace-config-proto.autogen))
When using this mode pass the `--txt` flag to `perfetto` to indicate the config
should be interpreted as a PBTX file:
@@ -212,10 +213,9 @@
#### Binary format
It is the preferred format for machine-to-machine (M2M) interaction. It involves
-passing the protobuf-encoded binary of the TraceConfig message.
-This can be obtained passing the PBTX in input to the protobuf's `protoc`
-compiler (which can be downloaded
-[here](https://github.com/protocolbuffers/protobuf/releases)).
+passing the protobuf-encoded binary of the TraceConfig message. This can be
+obtained passing the PBTX in input to the protobuf's `protoc` compiler (which
+can be downloaded [here](https://github.com/protocolbuffers/protobuf/releases)).
```bash
cd ~/code/perfetto # external/perfetto in the Android tree.
@@ -236,9 +236,9 @@
By default Perfetto keeps the full trace buffer(s) in memory and writes it into
the destination file (the `-o` cmdline argument) only at the end of the tracing
-session. This is to reduce the perf-intrusiveness of the tracing system.
-This, however, limits the max size of the trace to the physical memory size of
-the device, which is often too limiting.
+session. This is to reduce the perf-intrusiveness of the tracing system. This,
+however, limits the max size of the trace to the physical memory size of the
+device, which is often too limiting.
In some cases (e.g., benchmarks, hard to repro cases) it is desirable to capture
traces that are way larger than that, at the cost of extra I/O overhead.
@@ -246,29 +246,26 @@
To achieve that, Perfetto allows to periodically write the trace buffers into
the target file (or stdout) using the following TraceConfig fields:
-* `write_into_file (bool)`:
-When true periodically drains the trace buffers into the output
-file. When this option is enabled, the userspace buffers need to be just
-big enough to hold tracing data between two write periods.
-The buffer sizing depends on the activity of the device.
-The data rate of a typical trace is ~1-4 MB/s. So a 16MB in-memory buffer can
-hold for up write periods of ~4 seconds before starting to lose data.
+- `write_into_file (bool)`: When true periodically drains the trace buffers into
+ the output file. When this option is enabled, the userspace buffers need to be
+ just big enough to hold tracing data between two write periods. The buffer
+ sizing depends on the activity of the device. The data rate of a typical trace
+ is ~1-4 MB/s. So a 16MB in-memory buffer can hold for up write periods of ~4
+ seconds before starting to lose data.
-* `file_write_period_ms (uint32)`:
-Overrides the default drain period (5s). Shorter periods require a smaller
-userspace buffer but increase the performance intrusiveness of tracing. If
-the period given is less than 100ms, the tracing service will use a period
-of 100ms.
+- `file_write_period_ms (uint32)`: Overrides the default drain period (5s).
+ Shorter periods require a smaller userspace buffer but increase the
+ performance intrusiveness of tracing. If the period given is less than 100ms,
+ the tracing service will use a period of 100ms.
-* `max_file_size_bytes (uint64)`:
-If set, stops the tracing session after N bytes have been written. Used to
-cap the size of the trace.
+- `max_file_size_bytes (uint64)`: If set, stops the tracing session after N
+ bytes have been written. Used to cap the size of the trace.
For a complete example of a working trace config in long-tracing mode see
[`/test/configs/long_trace.cfg`](/test/configs/long_trace.cfg).
Summary: to capture a long trace just set `write_into_file:true`, set a long
- `duration_ms` and use an in-memory buffer size of 32MB or more.
+`duration_ms` and use an in-memory buffer size of 32MB or more.
## Data-source specific config
@@ -276,7 +273,8 @@
data-source-specific behaviors. At the proto schema level, this is defined in
the `DataSourceConfig` section of `TraceConfig`:
-From [data_source_config.proto](/protos/perfetto/config/data_source_config.proto):
+From
+[data_source_config.proto](/protos/perfetto/config/data_source_config.proto):
```protobuf
message TraceConfig {
@@ -312,42 +310,43 @@
implements data sources.
#### A note on backwards/forward compatibility
+
The tracing service will route the raw binary blob of the `DataSourceConfig`
message to the data sources with a matching name, without attempting to decode
and re-encode it. If the `DataSourceConfig` section of the trace config contains
a new field that didn't exist at the time when the service was built, the
-service will still pass the `DataSourceConfig` through to the data source.
-This allows to introduced new data sources without needing the service to
-know anything about them upfront.
+service will still pass the `DataSourceConfig` through to the data source. This
+allows to introduced new data sources without needing the service to know
+anything about them upfront.
TODO: we are aware of the fact that today extending the `DataSourceConfig` with
a custom proto requires changing the `data_source_config.proto` in the Perfetto
-repo, which is unideal for external projects. The long-term plan is to reserve
-a range of fields for non-upstream extensions and provide generic templated
+repo, which is unideal for external projects. The long-term plan is to reserve a
+range of fields for non-upstream extensions and provide generic templated
accessors for client code. Until then, we accept patches upstream to introduce
ad-hoc configurations for your own data sources.
## Multi-process data sources
Some data sources are singletons. E.g., in the case of scheduler tracing that
-Perfetto ships on Android, there is only data source for the whole system,
-owned by the `traced_probes` service.
+Perfetto ships on Android, there is only data source for the whole system, owned
+by the `traced_probes` service.
However, in the general case multiple processes can advertise the same data
source. This is the case, for instance, when using the
[Perfetto SDK](/docs/instrumentation/tracing-sdk.md) for userspace
instrumentation.
-If this happens, when starting a tracing session that specifies that data
-source in the trace config, Perfetto by default will ask all processes that
-advertise that data source to start it.
+If this happens, when starting a tracing session that specifies that data source
+in the trace config, Perfetto by default will ask all processes that advertise
+that data source to start it.
In some cases it might be desirable to further limit the enabling of the data
source to a specific process (or set of processes). That is possible through the
`producer_name_filter` and `producer_name_regex_filter`.
NOTE: the typical Perfetto run-time model is: one process == one Perfetto
- Producer; one Producer typically hosts multiple data sources.
+Producer; one Producer typically hosts multiple data sources.
When those filters are set, the Perfetto tracing service will activate the data
source only in the subset of producers matching the filter.
@@ -380,8 +379,8 @@
which is based on triggers. The overall idea is to declare in the trace config
itself:
-* A set of triggers, which are just free-form strings.
-* Whether a given trigger should cause the trace to be started or stopped, and
+- A set of triggers, which are just free-form strings.
+- Whether a given trigger should cause the trace to be started or stopped, and
the start/stop delay.
Why using triggers? Why can't one just start perfetto or kill(SIGTERM) it when
@@ -393,12 +392,12 @@
Triggers offer a way to unprivileged apps to control, in a limited fashion, the
lifecycle of a tracing session. The conceptual model is:
-* The privileged Consumer (see
- [_Service model_](/docs/concepts/service-model.md)), i.e. the entity
- that is normally authorized to start tracing (e.g., adb shell in Android),
- declares upfront what are the possible trigger names for the trace and what
- they will do.
-* Unprivileged entities (any random app process) can activate those triggers.
+- The privileged Consumer (see
+ [_Service model_](/docs/concepts/service-model.md)), i.e. the entity that is
+ normally authorized to start tracing (e.g., adb shell in Android), declares
+ upfront what are the possible trigger names for the trace and what they will
+ do.
+- Unprivileged entities (any random app process) can activate those triggers.
Unprivileged entities don't get a say on what the triggers will do, they only
communicate that an event happened.
@@ -417,12 +416,13 @@
Start triggers allow activating a tracing session only after some significant
event has happened. Passing a trace config that has `START_TRACING` trigger
-causes the tracing session to stay idle (i.e. not recording any data) until either
-the trigger is hit or the `trigger_timeout_ms` timeout is hit.
+causes the tracing session to stay idle (i.e. not recording any data) until
+either the trigger is hit or the `trigger_timeout_ms` timeout is hit.
`trace_duration_ms` and triggered traces can not be used at the same time.
Example config:
+
```protobuf
# If the "myapp_is_slow" is hit, the trace starts recording data and will be
# stopped after 5s.
@@ -450,12 +450,13 @@
signal.
This can be used to use perfetto in flight-recorder mode. By starting a trace
-with buffers configured in `RING_BUFFER` mode and `STOP_TRACING` triggers,
-the trace will be recorded in a loop and finalized when the culprit event is
+with buffers configured in `RING_BUFFER` mode and `STOP_TRACING` triggers, the
+trace will be recorded in a loop and finalized when the culprit event is
detected. This is key for events where the root cause is in the recent past
(e.g., the app detects a slow scroll or a missing frame).
Example config:
+
```protobuf
# If no trigger is hit, the trace will end after 30s.
trigger_timeout_ms: 30000
@@ -478,21 +479,20 @@
On Android, there are some caveats around using `adb shell`
-* Ctrl+C, which normally causes a graceful termination of the trace, is not
+- Ctrl+C, which normally causes a graceful termination of the trace, is not
propagated by ADB when using `adb shell perfetto` but only when using an
interactive PTY-based session via `adb shell`.
-* On non-rooted devices before Android 12, the config can only be passed as
+- On non-rooted devices before Android 12, the config can only be passed as
`cat config | adb shell perfetto -c -` (-: stdin) because of over-restrictive
SELinux rules. Since Android 12 `/data/misc/perfetto-configs` can be used for
storing configs.
-* On devices before Android 10, adb cannot directly pull
+- On devices before Android 10, adb cannot directly pull
`/data/misc/perfetto-traces`. Use
`adb shell cat /data/misc/perfetto-traces/trace > trace` to work around.
-* When capturing longer traces, e.g. in the context of benchmarks or CI, use
+- When capturing longer traces, e.g. in the context of benchmarks or CI, use
`PID=$(perfetto --background)` and then `kill $PID` to stop.
-
## Other resources
-* [TraceConfig Reference](/docs/reference/trace-config-proto.autogen)
-* [Buffers and dataflow](/docs/concepts/buffers.md)
+- [TraceConfig Reference](/docs/reference/trace-config-proto.autogen)
+- [Buffers and dataflow](/docs/concepts/buffers.md)
diff --git a/docs/contributing/common-tasks.md b/docs/contributing/common-tasks.md
index 43c5421..4a76189 100644
--- a/docs/contributing/common-tasks.md
+++ b/docs/contributing/common-tasks.md
@@ -24,7 +24,7 @@
- Running the file cannot generate any data. There can be only `CREATE PERFETTO {FUNCTION|TABLE|VIEW|MACRO}` statements inside.
- The name of each standard library object needs to start with `{module_name}_` or be prefixed with an underscore(`_`) for internal objects.
- The names must only contain lower and upper case letters and underscores. When a module is included (using the `INCLUDE PERFETTO MODULE`) the internal objects should not be treated as an API.
+ The names must only contain lower and upper case letters and underscores. When a module is included (using the `INCLUDE PERFETTO MODULE`) the internal objects should not be treated as an API.
- Every table or view should have [a schema](/docs/analysis/perfetto-sql-syntax.md#tableview-schema).
### Documentation
@@ -98,11 +98,11 @@
arg_set_id INT
)
AS
-SELECT
- slice_name,
- slice_ts,
- slice_dur,
- thread_name,
+SELECT
+ slice_name,
+ slice_ts,
+ slice_dur,
+ thread_name,
arg_set_id
FROM thread_slices_for_all_launches
WHERE launch_id = $launch_id AND slice_name GLOB $slice_name;
@@ -156,3 +156,17 @@
1. Go to `protos/perfetto/trace_processor/trace_processor.proto`
2. Increment `TRACE_PROCESSOR_CURRENT_API_VERSION`
3. Add a comment explaining what has changed.
+
+## Update statsd descriptor
+
+Perfetto has limited support for statsd atoms it does not know about.
+
+* Must be referred to using `raw_atom_id` in the config.
+* Show up as `atom_xxx.field_yyy` in trace processor.
+* Only top level messages are parsed.
+
+To update Perfetto's descriptor and handle new atoms from AOSP without these
+limitations:
+
+1. Run `tools/update-statsd-descriptor`.
+2. Upload and land your change as normal.
diff --git a/docs/data-sources/syscalls.md b/docs/data-sources/syscalls.md
index 3e6156d..8e769e8 100644
--- a/docs/data-sources/syscalls.md
+++ b/docs/data-sources/syscalls.md
@@ -15,13 +15,13 @@
At the UI level system calls are shown inlined with the per-thread slice tracks:
-![](/docs/images/syscalls.png "System calls in the thread tracks")
+![](/docs/images/syscalls.png 'System calls in the thread tracks')
## SQL
At the SQL level, syscalls are no different than any other userspace slice
event. They get interleaved in the per-thread slice stack and can be easily
-filtered by looking for the 'sys_' prefix:
+filtered by looking for the 'sys\_' prefix:
```sql
select ts, dur, t.name as thread, s.name, depth from slices as s
@@ -30,14 +30,14 @@
where s.name like 'sys_%'
```
-ts | dur | thread | name
----|-----|--------|------
-856325324372751 | 439867648 | s.nexuslauncher | sys_epoll_pwait
-856325324376970 | 990 | FpsThrottlerThr | sys_recvfrom
-856325324378376 | 2657 | surfaceflinger | sys_ioctl
-856325324419574 | 1250 | android.anim.lf | sys_recvfrom
-856325324428168 | 27344 | android.anim.lf | sys_ioctl
-856325324451345 | 573 | FpsThrottlerThr | sys_getuid
+| ts | dur | thread | name |
+| --------------- | --------- | --------------- | --------------- |
+| 856325324372751 | 439867648 | s.nexuslauncher | sys_epoll_pwait |
+| 856325324376970 | 990 | FpsThrottlerThr | sys_recvfrom |
+| 856325324378376 | 2657 | surfaceflinger | sys_ioctl |
+| 856325324419574 | 1250 | android.anim.lf | sys_recvfrom |
+| 856325324428168 | 27344 | android.anim.lf | sys_ioctl |
+| 856325324451345 | 573 | FpsThrottlerThr | sys_getuid |
## TraceConfig
diff --git a/docs/instrumentation/tracing-sdk.md b/docs/instrumentation/tracing-sdk.md
index a77d363..a3b7c85a 100644
--- a/docs/instrumentation/tracing-sdk.md
+++ b/docs/instrumentation/tracing-sdk.md
@@ -5,27 +5,26 @@
When using the Tracing SDK there are two main aspects to consider:
-1. Whether you are interested only in tracing events coming from your own app
- or want to collect full-stack traces that overlay app trace events with
- system trace events like scheduler traces, syscalls or any other Perfetto
- data source.
+1. Whether you are interested only in tracing events coming from your own app or
+ want to collect full-stack traces that overlay app trace events with system
+ trace events like scheduler traces, syscalls or any other Perfetto data
+ source.
2. For app-specific tracing, whether you need to trace simple types of timeline
- events (e.g., slices, counters) or need to define complex data sources with a
- custom strongly-typed schema (e.g., for dumping the state of a subsystem of
- your app into the trace).
+ events (e.g., slices, counters) or need to define complex data sources with a
+ custom strongly-typed schema (e.g., for dumping the state of a subsystem of
+ your app into the trace).
For Android-only instrumentation, the advice is to keep using the existing
-[android.os.Trace (SDK)][atrace-sdk] / [ATrace_* (NDK)][atrace-ndk] if they
+[android.os.Trace (SDK)][atrace-sdk] / [ATrace\_\* (NDK)][atrace-ndk] if they
are sufficient for your use cases. Atrace-based instrumentation is fully
-supported in Perfetto.
-See the [Data Sources -> Android System -> Atrace Instrumentation][atrace-ds]
-for details.
+supported in Perfetto. See the [Data Sources -> Android System -> Atrace
+Instrumentation][atrace-ds] for details.
## Getting started
-TIP: The code from these examples is also available [in the
-repository](/examples/sdk/README.md).
+TIP: The code from these examples is also available
+[in the repository](/examples/sdk/README.md).
To start using the Client API, first check out the latest SDK release:
@@ -105,9 +104,8 @@
Track events are the suggested option when dealing with app-specific tracing as
they take care of a number of subtleties (e.g., thread safety, flushing, string
-interning).
-Track events are time bounded events (e.g., slices, counter) based on simple
-`TRACE_EVENT` annotation tags in the codebase, like this:
+interning). Track events are time bounded events (e.g., slices, counter) based
+on simple `TRACE_EVENT` annotation tags in the codebase, like this:
```c++
#include <perfetto.h>
@@ -167,15 +165,14 @@
### Custom data sources
For most uses, track events are the most straightforward way of instrumenting
-apps for tracing. However, in some rare circumstances they are not
-flexible enough, e.g., when the data doesn't fit the notion of a track or is
-high volume enough that it needs a strongly typed schema to minimize the size of
-each event. In this case, you can implement a *custom data source* for
-Perfetto.
+apps for tracing. However, in some rare circumstances they are not flexible
+enough, e.g., when the data doesn't fit the notion of a track or is high volume
+enough that it needs a strongly typed schema to minimize the size of each event.
+In this case, you can implement a _custom data source_ for Perfetto.
Unlike track events, when working with custom data sources, you will also need
-corresponding changes in [trace processor](/docs/analysis/trace-processor.md)
-to enable importing your data format.
+corresponding changes in [trace processor](/docs/analysis/trace-processor.md) to
+enable importing your data format.
A custom data source is a subclass of `perfetto::DataSource`. Perfetto will
automatically create one instance of the class for each tracing session it is
@@ -248,9 +245,9 @@
```
If necessary the `Trace()` method can access the custom data source state
-(`my_custom_state` in the example above). Doing so, will take a mutex to
-ensure data source isn't destroyed (e.g., because of stopping tracing) while
-the `Trace()` method is called on another thread. For example:
+(`my_custom_state` in the example above). Doing so, will take a mutex to ensure
+data source isn't destroyed (e.g., because of stopping tracing) while the
+`Trace()` method is called on another thread. For example:
```C++
CustomDataSource::Trace([](CustomDataSource::TraceContext ctx) {
@@ -261,9 +258,9 @@
## In-process vs System mode
-The two modes are not mutually exclusive. An app can be configured to work
-in both modes and respond both to in-process tracing requests and system
-tracing requests. Both modes generate the same trace file format.
+The two modes are not mutually exclusive. An app can be configured to work in
+both modes and respond both to in-process tracing requests and system tracing
+requests. Both modes generate the same trace file format.
### In-process mode
@@ -275,8 +272,8 @@
`TracingInitArgs.backends = perfetto::kInProcessBackend` when initializing the
SDK, see examples below.
-This mode is used to generate traces that contain only events emitted by
-the app, but not other types of events (e.g. scheduler traces).
+This mode is used to generate traces that contain only events emitted by the
+app, but not other types of events (e.g. scheduler traces).
The main advantage is that by running fully in-process, it doesn't require any
special OS privileges and the profiled process can control the lifecycle of
@@ -293,32 +290,32 @@
`TracingInitArgs.backends = perfetto::kSystemBackend` when initializing the SDK,
see examples below.
-The main advantage of this mode is that it is possible to create fused traces where
-app events are overlaid on the same timeline of OS events. This enables
+The main advantage of this mode is that it is possible to create fused traces
+where app events are overlaid on the same timeline of OS events. This enables
full-stack performance investigations, looking all the way through syscalls and
kernel scheduling events.
-The main limitation of this mode is that it requires the external `traced` daemon
-to be up and running and reachable through the UNIX socket connection.
+The main limitation of this mode is that it requires the external `traced`
+daemon to be up and running and reachable through the UNIX socket connection.
This is suggested for local debugging or lab testing scenarios where the user
(or the test harness) can control the OS deployment (e.g., sideload binaries on
Android).
When using system mode, the tracing session must be controlled from the outside,
-using the `perfetto` command-line client
-(See [reference](/docs/reference/perfetto-cli)). This is because when collecting
+using the `perfetto` command-line client (See
+[reference](/docs/reference/perfetto-cli)). This is because when collecting
system traces, tracing data producers are not allowed to read back the trace
data as it might disclose information about other processes and allow
side-channel attacks.
-* On Android 9 (Pie) and beyond, traced is shipped as part of the platform.
-* On older versions of Android, traced can be built from sources using the
- the [standalone NDK-based workflow](/docs/contributing/build-instructions.md)
- and sideloaded via adb shell.
-* On Linux and MacOS and Windows `traced` must be built and run separately. See
+- On Android 9 (Pie) and beyond, traced is shipped as part of the platform.
+- On older versions of Android, traced can be built from sources using the the
+ [standalone NDK-based workflow](/docs/contributing/build-instructions.md) and
+ sideloaded via adb shell.
+- On Linux and MacOS and Windows `traced` must be built and run separately. See
the [Linux quickstart](/docs/quickstart/linux-tracing.md) for instructions.
-* On Windows the tracing protocol works over TCP/IP (
+- On Windows the tracing protocol works over TCP/IP (
[127.0.0.1:32278](https://cs.android.com/android/platform/superproject/main/+/main:external/perfetto/src/tracing/ipc/default_socket.cc;l=75;drc=4f88a2fdfd3801c109d5e927b8206f9756288b12)
) + named shmem.
@@ -370,12 +367,12 @@
```
TIP: API methods with `Blocking` in their name will suspend the calling thread
- until the respective operation is complete. There are also asynchronous
- variants that don't have this limitation.
+until the respective operation is complete. There are also asynchronous variants
+that don't have this limitation.
-Now that tracing is active, instruct your app to perform the operation you
-want to record. After that, stop tracing and collect the
-protobuf-formatted trace data:
+Now that tracing is active, instruct your app to perform the operation you want
+to record. After that, stop tracing and collect the protobuf-formatted trace
+data:
```C++
tracing_session->StopBlocking();
@@ -388,9 +385,9 @@
output.close();
```
-To save memory with longer traces, you can also tell Perfetto to write
-directly into a file by passing a file descriptor into Setup(), remembering
-to close the file after tracing is done:
+To save memory with longer traces, you can also tell Perfetto to write directly
+into a file by passing a file descriptor into Setup(), remembering to close the
+file after tracing is done:
```C++
int fd = open("example.perfetto-trace", O_RDWR | O_CREAT | O_TRUNC, 0600);
@@ -401,8 +398,9 @@
close(fd);
```
-The resulting trace file can be directly opened in the [Perfetto
-UI](https://ui.perfetto.dev) or the [Trace Processor](/docs/analysis/trace-processor.md).
+The resulting trace file can be directly opened in the
+[Perfetto UI](https://ui.perfetto.dev) or the
+[Trace Processor](/docs/analysis/trace-processor.md).
[ipc]: /docs/design-docs/api-and-abi.md#socket-protocol
[atrace-ds]: /docs/data-sources/atrace.md
diff --git a/docs/quickstart/callstack-sampling.md b/docs/quickstart/callstack-sampling.md
index 30fd74a..f597e5c 100644
--- a/docs/quickstart/callstack-sampling.md
+++ b/docs/quickstart/callstack-sampling.md
@@ -2,12 +2,12 @@
## Prerequisites
-* [ADB](https://developer.android.com/studio/command-line/adb) installed.
-* A device running Android T+.
-* Either a debuggable (`userdebug`/`eng`) Android image, or the apps to be
- profiled need to be
- [marked as profileable or debuggable](https://developer.android.com/guide/topics/manifest/profileable-element)
- in their manifests.
+- [ADB](https://developer.android.com/studio/command-line/adb) installed.
+- A device running Android T+.
+- Either a debuggable (`userdebug`/`eng`) Android image, or the apps to be
+ profiled need to be
+ [marked as profileable or debuggable](https://developer.android.com/guide/topics/manifest/profileable-element)
+ in their manifests.
## Capture a CPU profile
@@ -130,6 +130,6 @@
`cpu_profile` will also write separate profiles for each process that it
profiled in the output directory, and those can be visualized using
-[`pprof`](https://github.com/google/pprof). You can merge them into one
-by passing all of them to pprof, e.g.
+[`pprof`](https://github.com/google/pprof). You can merge them into one by
+passing all of them to pprof, e.g.
`pprof /tmp/perf_profile-240105114948clvad/*`.
diff --git a/infra/perfetto.dev/src/assets/script.js b/infra/perfetto.dev/src/assets/script.js
index 44adbf6..6c4d04d 100644
--- a/infra/perfetto.dev/src/assets/script.js
+++ b/infra/perfetto.dev/src/assets/script.js
@@ -69,7 +69,7 @@
toc.appendChild(li);
doAfterLoadEvent(() => {
tocAnchors.push(
- {top: anchor.offsetTop + anchor.offsetHeight / 2, obj: link});
+ { top: anchor.offsetTop + anchor.offsetHeight / 2, obj: link });
});
}
tocContainer.innerHTML = '';
@@ -81,7 +81,7 @@
return;
tocEventHandlersInstalled = true;
const doc = document.querySelector('.doc');
- const passive = {passive: true};
+ const passive = { passive: true };
if (doc) {
const offY = doc.offsetTop;
doc.addEventListener('mousemove', (e) => onMouseMove(offY, e), passive);
@@ -91,9 +91,9 @@
}
window.addEventListener('scroll', () => onScroll(), passive);
resizeObserver = new ResizeObserver(() => requestAnimationFrame(() => {
- updateNav();
- updateTOC();
- }));
+ updateNav();
+ updateTOC();
+ }));
resizeObserver.observe(doc);
}
@@ -235,7 +235,7 @@
function setupSearch() {
const URL =
- 'https://www.googleapis.com/customsearch/v1?key=AIzaSyBTD2XJkQkkuvDn76LSftsgWOkdBz9Gfwo&cx=007128963598137843411:8suis14kcmy&q='
+ 'https://www.googleapis.com/customsearch/v1?key=AIzaSyBTD2XJkQkkuvDn76LSftsgWOkdBz9Gfwo&cx=007128963598137843411:8suis14kcmy&q='
const searchContainer = document.getElementById('search');
const searchBox = document.getElementById('search-box');
const searchRes = document.getElementById('search-res')
diff --git a/infra/perfetto.dev/src/assets/style.scss b/infra/perfetto.dev/src/assets/style.scss
index 63d6fc1..0a0ff2e 100644
--- a/infra/perfetto.dev/src/assets/style.scss
+++ b/infra/perfetto.dev/src/assets/style.scss
@@ -15,234 +15,235 @@
// Common + CSS reset
// -----------------------------------------------------------------------------
:root {
- --site-header-height: 50px;
- --home-highlights-height: 128px;
- --content-max-width: 1100px;
- --anim-ease: cubic-bezier(0.4, 0.0, 0.2, 1);
+ --site-header-height: 50px;
+ --home-highlights-height: 128px;
+ --content-max-width: 1100px;
+ --anim-ease: cubic-bezier(0.4, 0, 0.2, 1);
- // This is set to 1 by JS after onload. This is to prevent flickering on
- // page load on the nav bar and other entries while transitioning in their
- // initial state.
- --anim-enabled: 0;
+ // This is set to 1 by JS after onload. This is to prevent flickering on
+ // page load on the nav bar and other entries while transitioning in their
+ // initial state.
+ --anim-enabled: 0;
- --anim-time: calc(0.15s * var(--anim-enabled));
+ --anim-time: calc(0.15s * var(--anim-enabled));
}
$wide: "(max-width: 1100px)";
$mobile: "(max-width: 768px)";
@mixin minimal-scrollbar {
- &::-webkit-scrollbar {
- width: 8px;
- background-color: transparent;
- }
- &::-webkit-scrollbar-thumb {
- background-color: #ccc;
- border-radius: 8px;
- }
+ &::-webkit-scrollbar {
+ width: 8px;
+ background-color: transparent;
+ }
+ &::-webkit-scrollbar-thumb {
+ background-color: #ccc;
+ border-radius: 8px;
+ }
}
@media (max-aspect-ratio: 1/1) {
- :root {
- --home-highlights-height: 256px;
- }
+ :root {
+ --home-highlights-height: 256px;
+ }
}
* {
- box-sizing: border-box;
- -webkit-tap-highlight-color: none;
+ box-sizing: border-box;
+ -webkit-tap-highlight-color: none;
}
html {
- font-family: Roboto, sans-serif;
- -webkit-font-smoothing: antialiased;
+ font-family: Roboto, sans-serif;
+ -webkit-font-smoothing: antialiased;
}
html,
body {
- padding: 0;
- margin: 0;
+ padding: 0;
+ margin: 0;
}
h1,
h2,
h3 {
- font-family: inherit;
- font-size: inherit;
- font-weight: inherit;
- padding: 0;
- margin: 0;
+ font-family: inherit;
+ font-size: inherit;
+ font-weight: inherit;
+ padding: 0;
+ margin: 0;
}
// -----------------------------------------------------------------------------
// Site header
// -----------------------------------------------------------------------------
.site-header {
- background-color: hsl(210, 30%, 16%);
- color: hsl(210, 17%, 98%);
- position: sticky; // Sticky so the .docs element below doesn't start @ 0.
+ background-color: hsl(210, 30%, 16%);
+ color: hsl(210, 17%, 98%);
+ position: sticky; // Sticky so the .docs element below doesn't start @ 0.
+ top: 0;
+ width: 100%;
+ --sh-padding-y: 5px;
+ max-height: var(--site-header-height);
+ padding: var(--sh-padding-y) 30px;
+ box-shadow: rgba(0, 0, 0, 0.3) 0 3px 3px 0;
+ overflow: hidden;
+ display: flex;
+ z-index: 10;
+ transition: max-height var(--anim-ease) var(--anim-time);
+ &.expanded {
+ max-height: 100vh;
+ }
+ .brand {
+ img {
+ height: 40px;
+ vertical-align: bottom;
+ }
+ font-weight: 200;
+ font-size: 28px;
+ flex-grow: 1;
+ .brand-docs {
+ text-transform: uppercase;
+ font-size: 14px;
+ color: #ecba2a;
+ vertical-align: bottom;
+ line-height: 30px;
+ font-weight: 400;
+ }
+ }
+ > *:not(:first-child) {
+ line-height: calc(var(--site-header-height) - var(--sh-padding-y) * 2);
+ font-family: "Source Sans Pro", sans-serif;
+ font-weight: 400;
+ font-size: 1.1rem;
+ margin: 0 20px;
+ color: hsl(210, 17%, 85%);
+ }
+ a {
+ text-decoration: none;
+ &:hover {
+ color: hsl(210, 17%, 100%);
+ }
+ }
+ .menu {
+ visibility: hidden;
+ font-family: "Material Icons Round";
+ font-size: 24px;
+ text-align: center;
+ position: absolute;
+ right: 0;
top: 0;
- width: 100%;
- --sh-padding-y: 5px;
- max-height: var(--site-header-height);
- padding: var(--sh-padding-y) 30px;
- box-shadow: rgba(0, 0, 0, 0.3) 0 3px 3px 0;
- overflow: hidden;
- display: flex;
- z-index: 10;
- transition: max-height var(--anim-ease) var(--anim-time);
- &.expanded {
- max-height: 100vh;
- }
- .brand {
- img {
- height: 40px;
- vertical-align: bottom;
- }
- font-weight: 200;
- font-size: 28px;
- flex-grow: 1;
- .brand-docs {
- text-transform: uppercase;
- font-size: 14px;
- color: #ecba2a;
- vertical-align: bottom;
- line-height: 30px;
- font-weight: 400;
- }
- }
- >*:not(:first-child) {
- line-height: calc(var(--site-header-height) - var(--sh-padding-y) * 2);
- font-family: 'Source Sans Pro', sans-serif;
- font-weight: 400;
- font-size: 1.1rem;
- margin: 0 20px;
- color: hsl(210, 17%, 85%);
- }
- a {
- text-decoration: none;
- &:hover {
- color: hsl(210, 17%, 100%);
- }
+ line-height: var(--site-header-height);
+ }
+
+ @media #{$mobile} {
+ flex-direction: column;
+ > *:not(:first-child) {
+ margin-left: 40px;
}
.menu {
- visibility: hidden;
- font-family: 'Material Icons Round';
- font-size: 24px;
- text-align: center;
- position: absolute;
- right: 0;
- top: 0;
- line-height: var(--site-header-height);
+ visibility: visible;
}
-
- @media #{$mobile} {
- flex-direction: column;
- >*:not(:first-child) {
- margin-left: 40px;
- }
- .menu {
- visibility: visible;
- }
- }
+ }
}
-
#search {
- position: relative;
- flex-grow: 0;
- transition: flex-grow cubic-bezier(1, 0.01, 1, 1) var(--anim-time), background-color ease var(--anim-time);
- padding: 0;
+ position: relative;
+ flex-grow: 0;
+ transition: flex-grow cubic-bezier(1, 0.01, 1, 1) var(--anim-time),
+ background-color ease var(--anim-time);
+ padding: 0;
+ &::before {
+ visibility: hidden;
+ user-select: none;
+ content: "";
+ position: fixed;
+ left: 0;
+ right: 0;
+ top: var(--site-header-height);
+ bottom: 0;
+ z-index: -100;
+ background-color: rgba(255, 255, 255, 0.8);
+ backdrop-filter: blur(3px);
+ opacity: 0;
+ transition: opacity ease var(--anim-time), visibility 0s;
+ }
+ &:focus-within {
+ flex-grow: 1000;
&::before {
- visibility: hidden;
- user-select: none;
- content: '';
- position: fixed;
- left: 0;
- right: 0;
- top: var(--site-header-height);
- bottom: 0;
- z-index: -100;
- background-color: rgba(255, 255, 255, 0.8);
- backdrop-filter: blur(3px);
- opacity: 0;
- transition: opacity ease var(--anim-time), visibility 0s;
-
+ display: block;
+ opacity: 1;
+ visibility: visible;
}
- &:focus-within {
- flex-grow: 1000;
- &::before {
- display: block;
- opacity: 1;
- visibility: visible;
- }
- #search-res {
- display: block;
- }
-
- }
-
- @media #{$mobile} {
- display: none;
- }
-
- #search-box {
- width: 100%;
- height: 32px;
- font-size: 1rem;;
- color: #333;
- background-color: rgba(255, 255, 255, 0.9);
- border: 1px solid #eee;
- border-radius: 2px;
- background-image: url('data:image/svg+xml;utf-8,<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M39.8 41.95 26.65 28.8q-1.5 1.3-3.5 2.025-2 .725-4.25.725-5.4 0-9.15-3.75T6 18.75q0-5.3 3.75-9.05 3.75-3.75 9.1-3.75 5.3 0 9.025 3.75 3.725 3.75 3.725 9.05 0 2.15-.7 4.15-.7 2-2.1 3.75L42 39.75Zm-20.95-13.4q4.05 0 6.9-2.875Q28.6 22.8 28.6 18.75t-2.85-6.925Q22.9 8.95 18.85 8.95q-4.1 0-6.975 2.875T9 18.75q0 4.05 2.875 6.925t6.975 2.875Z"/></svg>');
- background-repeat: no-repeat;
- background-size: contain;
- padding-left: 40px;
- outline: none;
- &:hover, &:focus {
- background-color: rgba(255, 255, 255, 0.95);
- }
- }
-
#search-res {
- display: none;
- background-color: rgba(255, 255, 255, 1.0);
- border: 1px solid #eee;
- box-shadow: #aaa 0px 1px 5px;
- color: #333;
- line-height: initial;
- margin-top: -4px;
- overflow-x: auto;
- position: fixed;
- top: var(--site-header-height);
- max-height: calc(100vh - var(--site-header-height));
- z-index: 10;
- >div {
- padding: 10px;
- margin: 0;
- &:hover {
- background-color: #f0f0f0;
- }
- }
- .sr-title {
- color: #333;
- font-weight: bold;
- }
- .sr-snippet {
- color: #444;
- font-size: 0.9rem;
- }
+ display: block;
+ }
+ }
- a { text-decoration: none; }
- a:hover { color: initial };
+ @media #{$mobile} {
+ display: none;
+ }
- &:empty {
- visibility: hidden;
- }
+ #search-box {
+ width: 100%;
+ height: 32px;
+ font-size: 1rem;
+ color: #333;
+ background-color: rgba(255, 255, 255, 0.9);
+ border: 1px solid #eee;
+ border-radius: 2px;
+ background-image: url('data:image/svg+xml;utf-8,<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M39.8 41.95 26.65 28.8q-1.5 1.3-3.5 2.025-2 .725-4.25.725-5.4 0-9.15-3.75T6 18.75q0-5.3 3.75-9.05 3.75-3.75 9.1-3.75 5.3 0 9.025 3.75 3.725 3.75 3.725 9.05 0 2.15-.7 4.15-.7 2-2.1 3.75L42 39.75Zm-20.95-13.4q4.05 0 6.9-2.875Q28.6 22.8 28.6 18.75t-2.85-6.925Q22.9 8.95 18.85 8.95q-4.1 0-6.975 2.875T9 18.75q0 4.05 2.875 6.925t6.975 2.875Z"/></svg>');
+ background-repeat: no-repeat;
+ background-size: contain;
+ padding-left: 40px;
+ outline: none;
+ &:hover,
+ &:focus {
+ background-color: rgba(255, 255, 255, 0.95);
+ }
+ }
+
+ #search-res {
+ display: none;
+ background-color: rgba(255, 255, 255, 1);
+ border: 1px solid #eee;
+ box-shadow: #aaa 0px 1px 5px;
+ color: #333;
+ line-height: initial;
+ margin-top: -4px;
+ overflow-x: auto;
+ position: fixed;
+ top: var(--site-header-height);
+ max-height: calc(100vh - var(--site-header-height));
+ z-index: 10;
+ > div {
+ padding: 10px;
+ margin: 0;
+ &:hover {
+ background-color: #f0f0f0;
+ }
+ }
+ .sr-title {
+ color: #333;
+ font-weight: bold;
+ }
+ .sr-snippet {
+ color: #444;
+ font-size: 0.9rem;
}
-}
+ a {
+ text-decoration: none;
+ }
+ a:hover {
+ color: initial;
+ }
+ &:empty {
+ visibility: hidden;
+ }
+ }
+}
// -----------------------------------------------------------------------------
// Site footer
@@ -250,722 +251,759 @@
// Footer in the index page.
.site-footer {
- background-color: hsl(210, 30%, 16%);
- padding: 1em 0;
- font-size: 14px;
- color: #fff;
- text-align: center;
- ul {
- list-style: none;
- margin: 0;
- padding: 0;
- li {
- display: inline;
- padding: 0 10px;
- &:not(:last-child) {
- border-right: solid 1px #fff;
- }
- }
+ background-color: hsl(210, 30%, 16%);
+ padding: 1em 0;
+ font-size: 14px;
+ color: #fff;
+ text-align: center;
+ ul {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ li {
+ display: inline;
+ padding: 0 10px;
+ &:not(:last-child) {
+ border-right: solid 1px #fff;
+ }
}
- a,
- a:visited {
- text-decoration: none;
- color: inherit;
- }
- .docs-footer-notice { display: none; }
+ }
+ a,
+ a:visited {
+ text-decoration: none;
+ color: inherit;
+ }
+ .docs-footer-notice {
+ display: none;
+ }
}
// Footer overrides for the /docs/ page.
.docs .site-footer {
- grid-area: footer;
- background: transparent;
- color: #666;
- text-align: left;
- margin: 0 20px;
- padding: 12px 0;
+ grid-area: footer;
+ background: transparent;
+ color: #666;
+ text-align: left;
+ margin: 0 20px;
+ padding: 12px 0;
- .docs-footer-notice {
- padding: 0;
- margin: 0;
- display: block;
- }
+ .docs-footer-notice {
+ padding: 0;
+ margin: 0;
+ display: block;
+ }
- ul { display: none; }
+ ul {
+ display: none;
+ }
}
// -----------------------------------------------------------------------------
// Site content
// -----------------------------------------------------------------------------
.site-content {
- .section-wrapper {
- border-bottom: solid 1px #eee;
- &:nth-child(2n+1) {
- background-color: hsl(210, 17%, 98%);
- }
+ .section-wrapper {
+ border-bottom: solid 1px #eee;
+ &:nth-child(2n + 1) {
+ background-color: hsl(210, 17%, 98%);
}
- section {
+ }
+ section {
+ display: block;
+ position: relative;
+ overflow: hidden;
+ padding: 0 20px;
+ margin: 0 auto;
+ max-width: calc(var(--content-max-width) + 2 * 20px);
+ }
+
+ .banner {
+ height: calc(
+ 100vh - var(--home-highlights-height) - var(--site-header-height)
+ );
+ @media (max-height: 639px) {
+ // If the screen is too short (e.g. smartphone in landscape mode)
+ // move the highlights sections (the four tiles) out of the visible
+ // viewport.
+ height: calc(100vh - var(--site-header-height));
+ }
+ min-height: 25vw;
+ display: grid;
+ grid-template-columns: 1fr;
+ grid-template-rows: 1fr 1fr 5fr;
+ h1,
+ h2 {
+ margin: auto;
+ font-family: "Source Sans Pro", sans-serif;
+ text-align: center;
+ color: hsl(0, 0, 35%);
+ span {
+ white-space: nowrap;
+ }
+ }
+ h1 {
+ font-size: 2.5rem;
+ font-size: calc(min(4rem, 8vw, 6vh));
+ font-weight: 400;
+ padding-top: calc(max(1rem, 2vh));
+ }
+ h2 {
+ font-size: 1.25rem;
+ font-size: calc(min(2rem, 6vw, 4vh));
+ font-weight: 200;
+ padding-top: 10px;
+ }
+ .home-img {
+ padding: 1rem 0;
+ overflow: hidden;
+ position: relative;
+ display: flex;
+ img {
+ max-height: 100%;
+ max-width: 100%;
+ margin: auto;
display: block;
- position: relative;
- overflow: hidden;
- padding: 0 20px;
- margin: 0 auto;
- max-width: calc(var(--content-max-width) + 2 * 20px);
+ }
}
+ }
- .banner {
- height: calc(100vh - var(--home-highlights-height) - var(--site-header-height));
- @media (max-height: 639px) {
- // If the screen is too short (e.g. smartphone in landscape mode)
- // move the highlights sections (the four tiles) out of the visible
- // viewport.
- height: calc(100vh - var(--site-header-height));
+ .home-highlights {
+ &:before {
+ border-top: 1px solid hsl(210, 17%, 90%);
+ }
+ height: var(--home-highlights-height);
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ grid-template-rows: 1fr;
+ background-color: #fff;
+ z-index: 2;
+ @media (max-aspect-ratio: 1/1) {
+ grid-template-columns: repeat(2, 1fr);
+ }
+ > a {
+ color: hsl(0, 0, 20%);
+ font-size: 22px;
+ font-weight: 400;
+ text-align: center;
+ padding: 20px 0;
+ font-family: "Source Sans Pro", sans-serif;
+ text-decoration: none;
+ .icon {
+ background-image: url("/assets/sprite.png");
+ background-repeat: no-repeat;
+ width: 64px;
+ height: 64px;
+ margin: auto;
+ background-size: 256px 128px;
+ filter: grayscale(1);
+ transition: filter ease var(--anim-time);
+ }
+ &:nth-child(1) .icon {
+ background-position: 0 -64px;
+ }
+ &:nth-child(2) .icon {
+ background-position: -64px -64px;
+ }
+ &:nth-child(3) .icon {
+ background-position: -128px -64px;
+ }
+ &:nth-child(4) .icon {
+ background-position: -192px -64px;
+ }
+ &:hover {
+ background-color: hsl(210, 17%, 90%);
+ .icon {
+ filter: grayscale(0);
}
- min-height: 25vw;
- display: grid;
+ }
+ }
+ }
+ .home-section {
+ min-height: calc(min(100vh - var(--site-header-height), 800px));
+ padding: 5% 20px;
+ display: grid;
+ grid-template-rows: 1fr;
+ grid-column-gap: 4vw;
+ > img {
+ grid-area: img;
+ max-width: 100%;
+ max-height: 55vh;
+ margin: auto;
+ margin-top: 40px;
+ }
+ h2,
+ > div {
+ grid-area: content;
+ }
+ h2 {
+ font-family: "Source Sans Pro", sans-serif;
+ font-weight: 600;
+ font-size: 2.5rem;
+ color: #333;
+ text-align: center;
+ }
+ &:nth-child(2n) {
+ grid-template-columns: 5fr 4fr;
+ grid-template-areas: "content img";
+ h2 {
+ padding: 0 0 0 50px;
+ text-align: left;
+ }
+ }
+ &:nth-child(2n + 1) {
+ grid-template-columns: 4fr 5fr;
+ grid-template-areas: "img content";
+ h2 {
+ padding: 0 50px 0 0;
+ text-align: left;
+ }
+ }
+ @media (max-aspect-ratio: 1/1) {
+ padding: 5vh 20px;
+ &:nth-child(n) {
+ grid-template-rows: auto auto;
grid-template-columns: 1fr;
- grid-template-rows: 1fr 1fr 5fr;
- h1,
+ grid-template-areas: "img" "content";
+ grid-row-gap: 30px;
h2 {
- margin: auto;
- font-family: 'Source Sans Pro', sans-serif;
- text-align: center;
- color: hsl(0, 0, 35%);
- span {
- white-space: nowrap;
- }
+ padding: 0;
+ text-align: center;
}
- h1 {
- font-size: 2.5rem;
- font-size: calc(min(4rem, 8vw, 6vh));
- font-weight: 400;
- padding-top: calc(max(1rem, 2vh));
- }
- h2 {
- font-size: 1.25rem;
- font-size: calc(min(2rem, 6vw, 4vh));
- font-weight: 200;
- padding-top: 10px;
- }
- .home-img {
- padding: 1rem 0;
- overflow: hidden;
- position: relative;
- display: flex;
- img {
- max-height: 100%;
- max-width: 100%;
- margin: auto;
- display: block;
- }
- }
+ }
+ > img {
+ padding: 0 10vw;
+ }
}
-
-
- .home-highlights {
- &:before {
- border-top: 1px solid hsl(210, 17%, 90%);
+ div {
+ grid-area: content;
+ .button {
+ display: inline-block;
+ background: #337ab7;
+ font-weight: 500;
+ color: #fff;
+ border-radius: 6px;
+ font-size: 18px;
+ padding: 10px 16px;
+ transition: background-color ease var(--anim-time);
+ text-decoration: none;
+ &:hover {
+ background: #286090;
}
- height: var(--home-highlights-height);
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- grid-template-rows: 1fr;
- background-color: #fff;
- z-index: 2;
- @media (max-aspect-ratio: 1/1) {
- grid-template-columns: repeat(2, 1fr);
- }
- >a {
- color: hsl(0, 0, 20%);
- font-size: 22px;
- font-weight: 400;
- text-align: center;
- padding: 20px 0;
- font-family: 'Source Sans Pro', sans-serif;
- text-decoration: none;
- .icon {
- background-image: url('/assets/sprite.png');
- background-repeat: no-repeat;
- width: 64px;
- height: 64px;
- margin: auto;
- background-size: 256px 128px;
- filter: grayscale(1);
- transition: filter ease var(--anim-time);
- }
- &:nth-child(1) .icon {
- background-position: 0 -64px;
- }
- &:nth-child(2) .icon {
- background-position: -64px -64px;
- }
- &:nth-child(3) .icon {
- background-position: -128px -64px;
- }
- &:nth-child(4) .icon {
- background-position: -192px -64px;
- }
- &:hover {
- background-color: hsl(210, 17%, 90%);
- .icon {
- filter: grayscale(0);
- }
- }
- }
+ }
}
- .home-section {
- min-height: calc(min(100vh - var(--site-header-height), 800px));
- padding: 5% 20px;
- display: grid;
- grid-template-rows: 1fr;
- grid-column-gap: 4vw;
- >img {
- grid-area: img;
- max-width: 100%;
- max-height: 55vh;
- margin: auto;
- margin-top: 40px;
- }
- h2,
- >div {
- grid-area: content;
- }
- h2 {
- font-family: 'Source Sans Pro', sans-serif;
- font-weight: 600;
- font-size: 2.5rem;
- color: #333;
- text-align: center;
- }
- &:nth-child(2n) {
- grid-template-columns: 5fr 4fr;
- grid-template-areas: "content img";
- h2 {
- padding: 0 0 0 50px;
- text-align: left;
- }
- }
- &:nth-child(2n+1) {
- grid-template-columns: 4fr 5fr;
- grid-template-areas: "img content";
- h2 {
- padding: 0 50px 0 0;
- text-align: left;
- }
- }
- @media (max-aspect-ratio: 1/1) {
- padding: 5vh 20px;
- &:nth-child(n) {
- grid-template-rows: auto auto;
- grid-template-columns: 1fr;
- grid-template-areas: "img" "content";
- grid-row-gap: 30px;
- h2 {
- padding: 0;
- text-align: center;
- }
- }
- >img {
- padding: 0 10vw;
- }
- }
- div {
- grid-area: content;
- .button {
- display: inline-block;
- background: #337ab7;
- font-weight: 500;
- color: #fff;
- border-radius: 6px;
- font-size: 18px;
- padding: 10px 16px;
- transition: background-color ease var(--anim-time);
- text-decoration: none;
- &:hover {
- background: #286090;
- }
- }
- }
- .home-item {
- display: grid;
- grid-template-rows: auto auto;
- grid-template-columns: 50px auto;
- grid-template-areas: "img title" "img label";
- grid-column-gap: 20px;
- padding: 20px 30px;
- margin: 10px 0;
- // border: 1px solid #eee;
- font-family: 'Source Sans Pro', sans-serif;
- color: #111111;
- transition: filter var(--anim-ease) var(--anim-time), background-color var(--anim-ease) var(--anim-time), transform var(--anim-ease) var(--anim-time), box-shadow linear var(--anim-time);
- border-radius: 6px;
- filter: opacity(0.6);
- &:hover {
- background-color: hsla(0, 0, 0, 0.02);
- filter: opacity(1);
- transform: scale(1.01);
- }
- >img,
- >i {
- grid-area: img;
- margin: auto;
- font-size: 50px;
- }
- >h3 {
- grid-area: title;
- font-size: 1.25rem;
- line-height: 20px;
- font-weight: 600;
- }
- >p {
- grid-area: label;
- font-size: 1rem;
- font-weight: 400;
- margin: 1em 0;
- }
- }
+ .home-item {
+ display: grid;
+ grid-template-rows: auto auto;
+ grid-template-columns: 50px auto;
+ grid-template-areas: "img title" "img label";
+ grid-column-gap: 20px;
+ padding: 20px 30px;
+ margin: 10px 0;
+ // border: 1px solid #eee;
+ font-family: "Source Sans Pro", sans-serif;
+ color: #111111;
+ transition: filter var(--anim-ease) var(--anim-time),
+ background-color var(--anim-ease) var(--anim-time),
+ transform var(--anim-ease) var(--anim-time),
+ box-shadow linear var(--anim-time);
+ border-radius: 6px;
+ filter: opacity(0.6);
+ &:hover {
+ background-color: hsla(0, 0, 0, 0.02);
+ filter: opacity(1);
+ transform: scale(1.01);
+ }
+ > img,
+ > i {
+ grid-area: img;
+ margin: auto;
+ font-size: 50px;
+ }
+ > h3 {
+ grid-area: title;
+ font-size: 1.25rem;
+ line-height: 20px;
+ font-weight: 600;
+ }
+ > p {
+ grid-area: label;
+ font-size: 1rem;
+ font-weight: 400;
+ margin: 1em 0;
+ }
}
+ }
}
// -----------------------------------------------------------------------------
// Docs
// -----------------------------------------------------------------------------
.docs {
- min-height: 100vh;
- display: grid;
- --nav-width: 240px;
- --toc-width: 180px;
+ min-height: 100vh;
+ display: grid;
+ --nav-width: 240px;
+ --toc-width: 180px;
- // 1665px is the clientWidth on a macbook pro. Adjust the layout so that
- // the max-width of the central .doc fits precisely when the browser is
- // full-screen on a macbook.
- --max-doc-width: calc(1665px - var(--toc-width) - var(--nav-width));
+ // 1665px is the clientWidth on a macbook pro. Adjust the layout so that
+ // the max-width of the central .doc fits precisely when the browser is
+ // full-screen on a macbook.
+ --max-doc-width: calc(1665px - var(--toc-width) - var(--nav-width));
- grid-template-columns: var(--nav-width) minmax(auto, var(--max-doc-width)) var(--toc-width);
- grid-template-rows: 1fr max-content;
- grid-template-areas: "nav doc toc" "nav footer toc";
+ grid-template-columns: var(--nav-width) minmax(auto, var(--max-doc-width)) var(
+ --toc-width
+ );
+ grid-template-rows: 1fr max-content;
+ grid-template-areas: "nav doc toc" "nav footer toc";
- background-color: hsl(210, 10%, 97%);
- .nav {
- grid-area: nav;
- border-right: 1px solid hsl(210, 30%, 90%);
- background-color: #fefefe;
- padding: 20px 0;
- padding-right: 16px;
+ background-color: hsl(210, 10%, 97%);
+ .nav {
+ grid-area: nav;
+ border-right: 1px solid hsl(210, 30%, 90%);
+ background-color: #fefefe;
+ padding: 20px 0;
+ padding-right: 16px;
- position: sticky;
- top: var(--site-header-height);
- height: calc(100vh - var(--site-header-height));
- overflow-y: auto;
- @include minimal-scrollbar;
+ position: sticky;
+ top: var(--site-header-height);
+ height: calc(100vh - var(--site-header-height));
+ overflow-y: auto;
+ @include minimal-scrollbar;
- a {
- color: inherit;
- text-decoration: none;
- line-height: 24px;
- display: flex;
- transition: background-color var(--anim-ease) var(--anim-time),
- visibility linear var(--anim-time);
- border-radius: 0 10px 10px 0;
- -webkit-tap-highlight-color: transparent;
- &[href] {
- &:hover {
- color: #000;
- background-color: #f1f3f4;
- }
- &.selected {
- background-color: #ecba2a;
- }
- }
+ a {
+ color: inherit;
+ text-decoration: none;
+ line-height: 24px;
+ display: flex;
+ transition: background-color var(--anim-ease) var(--anim-time),
+ visibility linear var(--anim-time);
+ border-radius: 0 10px 10px 0;
+ -webkit-tap-highlight-color: transparent;
+ &[href] {
+ &:hover {
+ color: #000;
+ background-color: #f1f3f4;
}
-
- ul {
- list-style: none;
- margin: 0;
- padding: 0;
- overflow: hidden;
- li {
- font-size: 1rem;
- font-weight: 400;
- font-family: 'Source Sans Pro', sans-serif;
- color: #4a4a4a;
- max-width: 100%;
- margin: 3px 0;
- }
- p { margin: 0; }
+ &.selected {
+ background-color: #ecba2a;
}
-
- // Applies only to outer-level submenus.
- >ul {
- position: static; // Otherwise gets v-centered in the middle.
- > li {
- padding-bottom: 10px;
- margin-bottom: 10px;
- font-weight: 600;
- color: #111;
-
- &:not(:last-child) {
- border-bottom: 1px solid #eee;
- }
-
- &.compressible {
- > p > a::after {
- content: 'keyboard_arrow_up';
- font-family: 'Material Icons Round';
- font-size: 24px;
- width: 24px;
- transition: transform var(--anim-ease) var(--anim-time);
- margin: 0 0 0 auto;
- font-weight: 200;
- color: #666;
- }
- > ul {
- transition: max-height var(--anim-ease) var(--anim-time),
- opacity var(--anim-ease) var(--anim-time);
- opacity: 1;
- }
- &.compressed {
- // The JS will compute and set the maxHeight on each
- // element depending on the size of their children.
- // !important is needed to override the element-inline
- // max-height property set by JS, which is prioritary.
- > ul {
- max-height: 0 !important;
- visibility: hidden;
- opacity: 0;
- }
- > p > a::after {
- transform: scaleY(-1);
- }
- }
- } // .compressible
-
- }
- }
-
- li a {
- padding-left: 16px;
- }
- li li a {
- padding-left: 30px;
- }
- li li li a {
- padding-left: 44px;
- }
- .expanded a::after {
- transform: rotate(180deg);
- }
+ }
}
- .doc {
- grid-area: doc;
- background-color: #fff;
- margin: 20px;
- padding: 30px 40px;
- font-family: Roboto, sans-serif;
+
+ ul {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+ li {
font-size: 1rem;
font-weight: 400;
- line-height: 24px;
- -webkit-font-smoothing: antialiased;
+ font-family: "Source Sans Pro", sans-serif;
color: #4a4a4a;
- position: relative;
- box-shadow: 0 1px 2px 0 rgba(60, 64, 67, .1), 0 1px 3px 1px rgba(60, 64, 67, .15);
- overflow: hidden;
+ max-width: 100%;
+ margin: 3px 0;
+ }
+ p {
+ margin: 0;
+ }
+ }
- a {
- text-decoration: none;
- &:link { color: #007b83; }
- &:visited { color: #8e3317; }
- &:hover { color: #009da8; }
- &[href^="http"] {
- // External link.
- &:after {
- content: 'open_in_new';
- font-family: 'Material Icons Round';
- color: #666;
- text-decoration: none;
- margin-left: 2px;
- margin-right: 4px;
- vertical-align: bottom;
- }
- }
+ // Applies only to outer-level submenus.
+ > ul {
+ position: static; // Otherwise gets v-centered in the middle.
+ > li {
+ padding-bottom: 10px;
+ margin-bottom: 10px;
+ font-weight: 600;
+ color: #111;
+
+ &:not(:last-child) {
+ border-bottom: 1px solid #eee;
}
- h1,
- h2,
- h3 {
- margin: 10px 0;
- padding: 0;
- padding-top: 30px;
- }
- h1 {
- font-size: 2.25rem;
- line-height: 2.25rem;
- margin: 0;
- padding: 0;
- margin-bottom: 1.5rem;
- font-family: 'Source Sans Pro', sans-serif;
- }
- h2 {
- font-size: 1.5rem;
- border-bottom: 1px solid #e8eaed;
- padding-bottom: 6px;
- }
- h3 {
- font-size: 1.25rem;
- }
- * {
- max-width: 100%;
- }
-
- img[alt$="screenshot"] {
- box-shadow: 0 0 10px 2px #eee;
- }
-
- code:not(.code-block) {
- background: hsla(210, 17%, 90%, 0.2);
- border: 1px solid #E8EAED;
- border-radius: 6px;
- padding: 1px 4px;
- }
- .code-block {
- overflow-x: auto;
- white-space: pre;
- border-radius: 6px;
- box-shadow: 1px 1px 6px #999;
- border-top: 5px solid #8BC34A;
- }
- // Hide mermaid graphs until they are rendered, this is to avoid showing
- // the mermaid source while the renderer generates the SVG.
- .mermaid {
- transition: opacity var(--anim-ease) var(--anim-time);
- &:not(.rendered) {
- opacity: 0;
- }
- }
- .anchor {
- margin-left: -29px;
- padding-right: 5px;
- text-decoration: none;
- position: absolute;
- padding-top: var(--site-header-height);
- margin-top: calc(-1 * var(--site-header-height));
- outline: none;
- opacity: 0;
- transition: opacity var(--anim-ease) var(--anim-time);
- &::before {
- content: 'insert_link';
- font-family: 'Material Icons Round';
- color: #333;
- font-size: 24px;
- }
- }
- *:hover .anchor {
+ &.compressible {
+ > p > a::after {
+ content: "keyboard_arrow_up";
+ font-family: "Material Icons Round";
+ font-size: 24px;
+ width: 24px;
+ transition: transform var(--anim-ease) var(--anim-time);
+ margin: 0 0 0 auto;
+ font-weight: 200;
+ color: #666;
+ }
+ > ul {
+ transition: max-height var(--anim-ease) var(--anim-time),
+ opacity var(--anim-ease) var(--anim-time);
opacity: 1;
+ }
+ &.compressed {
+ // The JS will compute and set the maxHeight on each
+ // element depending on the size of their children.
+ // !important is needed to override the element-inline
+ // max-height property set by JS, which is prioritary.
+ > ul {
+ max-height: 0 !important;
+ visibility: hidden;
+ opacity: 0;
+ }
+ > p > a::after {
+ transform: scaleY(-1);
+ }
+ }
+ } // .compressible
+ }
+ }
+
+ li a {
+ padding-left: 16px;
+ }
+ li li a {
+ padding-left: 30px;
+ }
+ li li li a {
+ padding-left: 44px;
+ }
+ .expanded a::after {
+ transform: rotate(180deg);
+ }
+ }
+ .doc {
+ grid-area: doc;
+ background-color: #fff;
+ margin: 20px;
+ padding: 30px 40px;
+ font-family: Roboto, sans-serif;
+ font-size: 1rem;
+ font-weight: 400;
+ line-height: 24px;
+ -webkit-font-smoothing: antialiased;
+ color: #4a4a4a;
+ position: relative;
+ box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.1),
+ 0 1px 3px 1px rgba(60, 64, 67, 0.15);
+ overflow: hidden;
+
+ a {
+ text-decoration: none;
+ &:link {
+ color: #007b83;
+ }
+ &:visited {
+ color: #8e3317;
+ }
+ &:hover {
+ color: #009da8;
+ }
+ &[href^="http"] {
+ // External link.
+ &:after {
+ content: "open_in_new";
+ font-family: "Material Icons Round";
+ color: #666;
+ text-decoration: none;
+ margin-left: 2px;
+ margin-right: 4px;
+ vertical-align: bottom;
}
+ }
+ }
+
+ h1,
+ h2,
+ h3 {
+ margin: 10px 0;
+ padding: 0;
+ padding-top: 30px;
+ }
+ h1 {
+ font-size: 2.25rem;
+ line-height: 2.25rem;
+ margin: 0;
+ padding: 0;
+ margin-bottom: 1.5rem;
+ font-family: "Source Sans Pro", sans-serif;
+ }
+ h2 {
+ font-size: 1.5rem;
+ border-bottom: 1px solid #e8eaed;
+ padding-bottom: 6px;
+ }
+ h3 {
+ font-size: 1.25rem;
+ }
+ * {
+ max-width: 100%;
+ }
+
+ img[alt$="screenshot"] {
+ box-shadow: 0 0 10px 2px #eee;
+ }
+
+ code:not(.code-block) {
+ background: hsla(210, 17%, 90%, 0.2);
+ border: 1px solid #e8eaed;
+ border-radius: 6px;
+ padding: 1px 4px;
+ }
+ .code-block {
+ overflow-x: auto;
+ white-space: pre;
+ border-radius: 6px;
+ box-shadow: 1px 1px 6px #999;
+ border-top: 5px solid #8bc34a;
+ }
+ // Hide mermaid graphs until they are rendered, this is to avoid showing
+ // the mermaid source while the renderer generates the SVG.
+ .mermaid {
+ transition: opacity var(--anim-ease) var(--anim-time);
+ &:not(.rendered) {
+ opacity: 0;
+ }
+ }
+ .anchor {
+ margin-left: -29px;
+ padding-right: 5px;
+ text-decoration: none;
+ position: absolute;
+ padding-top: var(--site-header-height);
+ margin-top: calc(-1 * var(--site-header-height));
+ outline: none;
+ opacity: 0;
+ transition: opacity var(--anim-ease) var(--anim-time);
+ &::before {
+ content: "insert_link";
+ font-family: "Material Icons Round";
+ color: #333;
+ font-size: 24px;
+ }
+ }
+ *:hover .anchor {
+ opacity: 1;
+ }
+ code {
+ font-family: "Roboto Mono", monospace;
+ font-size: 14px;
+ }
+ table {
+ width: 100%;
+ font-size: 14px;
+ border-spacing: 0;
+ border-collapse: collapse;
+ th,
+ td {
+ padding: 8px;
+ border: 0 solid #dadce0;
+ border-top-width: 1px;
+ border-bottom-width: 1px;
+ }
+ tr {
+ height: 20px;
+ }
+ tr:target {
+ background-color: #ecba2a;
+ }
+ thead {
+ text-align: left;
+ background-color: #e8eaed;
+ color: #202124;
+ }
+ }
+
+ &[data-md-file^="/docs/reference/"] {
+ h1,
+ h2,
+ h3 {
code {
- font-family: 'Roboto Mono', monospace;
- font-size: 14px;
+ margin-left: 20px;
+ color: #666;
}
- table {
- width: 100%;
- font-size: 14px;
- border-spacing: 0;
- border-collapse: collapse;
- th, td {
- padding: 8px;
- border: 0 solid #dadce0;
- border-top-width: 1px;
- border-bottom-width: 1px;
-
- }
- tr {
- height: 20px;
- }
- tr:target {
- background-color: #ecba2a;
- }
- thead {
- text-align: left;
- background-color: #e8eaed;
- color: #202124;
- }
+ }
+ table {
+ width: 100%;
+ font-size: 14px;
+ border-spacing: 0;
+ border-collapse: collapse;
+ th,
+ td {
+ padding: 8px;
+ border: 0 solid #dadce0;
+ border-top-width: 1px;
+ border-bottom-width: 1px;
}
+ tr {
+ height: 20px;
+ }
+ thead {
+ text-align: left;
+ background-color: #e8eaed;
+ color: #202124;
+ }
+ td {
+ &:first-child {
+ background: #f7f7f7;
+ }
- &[data-md-file^="/docs/reference/"] {
- h1, h2, h3 {
- code {
- margin-left: 20px;
- color: #666;
- }
- }
- table {
- width: 100%;
- font-size: 14px;
- border-spacing: 0;
- border-collapse: collapse;
- th, td {
- padding: 8px;
- border: 0 solid #dadce0;
- border-top-width: 1px;
- border-bottom-width: 1px;
-
- }
- tr {
- height: 20px;
- }
- thead {
- text-align: left;
- background-color: #e8eaed;
- color: #202124;
- }
- td {
- &:first-child { background: #f7f7f7; }
-
- /* Not really 100% but makes sure that the description
+ /* Not really 100% but makes sure that the description
* column takes most of the width */
- &:last-child { width: 80%; }
- }
- }
+ &:last-child {
+ width: 80%;
+ }
}
-
- .callout {
- padding: .5rem .5rem .5rem 2rem;
- border: none;
- border-radius: 2px;
- margin-left: auto;
- margin-right: auto;
- width: 90%;
- border-left: 3px solid transparent;
- box-shadow: 0 0.2rem 0.5rem rgba(0,0,0,.05), 0 0 0.05rem rgba(0,0,0,.1);
-
- &:before {
- font-family: 'Material Icons Round';
- position: absolute;
- font-size: 1.5rem;
- margin-left: -1.75rem;
- margin-top: -2px;
- }
-
- &.note {
- background-color: #E8F0FE;
- border-color: #1967D2;
- color: #1967D2;
- &:before { content: 'bookmark'; }
- }
-
- &.summary {
- background-color: #E4F7FB;
- border-color: #129EAF;
- color: #129EAF;
- &:before { content: 'sms'; }
- }
-
- &.tip {
- background-color: #E6F4EA;
- border-color: #188038;
- color: #188038;
- &:before { content: 'star'; }
- }
-
- &.todo {
- background-color: #F1F3F4;
- border-color: #5F6368;
- color: #5F6368;
- &:before { content: 'error'; }
- }
-
- &.warning {
- background-color: #FCE8E6;
- border-color: #C5221F;
- color: #C5221F;
- &:before { content: 'warning'; }
- }
- }
+ }
}
- .toc {
- grid-area: toc;
- padding: 20px 16px 20px 0;
- position: sticky;
- top: var(--site-header-height);
- height: calc(100vh - var(--site-header-height));
- overflow-y: auto;
- @include minimal-scrollbar;
+ .callout {
+ padding: 0.5rem 0.5rem 0.5rem 2rem;
+ border: none;
+ border-radius: 2px;
+ margin-left: auto;
+ margin-right: auto;
+ width: 90%;
+ border-left: 3px solid transparent;
+ box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05),
+ 0 0 0.05rem rgba(0, 0, 0, 0.1);
- font-family: 'Source Sans Pro', sans-serif;
- word-break: break-word;
- a {
- text-decoration: none;
+ &:before {
+ font-family: "Material Icons Round";
+ position: absolute;
+ font-size: 1.5rem;
+ margin-left: -1.75rem;
+ margin-top: -2px;
+ }
+
+ &.note {
+ background-color: #e8f0fe;
+ border-color: #1967d2;
+ color: #1967d2;
+ &:before {
+ content: "bookmark";
}
- a,
- a:visited {
- color: #333;
+ }
+
+ &.summary {
+ background-color: #e4f7fb;
+ border-color: #129eaf;
+ color: #129eaf;
+ &:before {
+ content: "sms";
}
- a.highlighted {
- font-weight: 500;
- color: hsl(45, 100%, 40%);
+ }
+
+ &.tip {
+ background-color: #e6f4ea;
+ border-color: #188038;
+ color: #188038;
+ &:before {
+ content: "star";
}
- font-size: 0.875rem;
- ul {
- list-style: none;
- margin: 0;
- padding: 0;
- li {
- margin: 5px 0;
- /* This make it so that a single word gets elided but if there
+ }
+
+ &.todo {
+ background-color: #f1f3f4;
+ border-color: #5f6368;
+ color: #5f6368;
+ &:before {
+ content: "error";
+ }
+ }
+
+ &.warning {
+ background-color: #fce8e6;
+ border-color: #c5221f;
+ color: #c5221f;
+ &:before {
+ content: "warning";
+ }
+ }
+ }
+ }
+ .toc {
+ grid-area: toc;
+ padding: 20px 16px 20px 0;
+
+ position: sticky;
+ top: var(--site-header-height);
+ height: calc(100vh - var(--site-header-height));
+ overflow-y: auto;
+ @include minimal-scrollbar;
+
+ font-family: "Source Sans Pro", sans-serif;
+ word-break: break-word;
+ a {
+ text-decoration: none;
+ }
+ a,
+ a:visited {
+ color: #333;
+ }
+ a.highlighted {
+ font-weight: 500;
+ color: hsl(45, 100%, 40%);
+ }
+ font-size: 0.875rem;
+ ul {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ li {
+ margin: 5px 0;
+ /* This make it so that a single word gets elided but if there
* are multiple words they span across lines. */
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: break-spaces;
- word-break: normal;
- }
- }
- >ul {
- border-left: 4px solid #ecba2a;
- padding-left: 10px;
- position: static; // Otherwise gets v-centered in the middle.
- top: calc(var(--site-header-height) + 25px);
- }
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: break-spaces;
+ word-break: normal;
+ }
}
+ > ul {
+ border-left: 4px solid #ecba2a;
+ padding-left: 10px;
+ position: static; // Otherwise gets v-centered in the middle.
+ top: calc(var(--site-header-height) + 25px);
+ }
+ }
- @media #{$wide} {
- grid-template-columns: var(--nav-width) auto 0;
- .toc { display: none; }
+ @media #{$wide} {
+ grid-template-columns: var(--nav-width) auto 0;
+ .toc {
+ display: none;
}
- @media #{$mobile} {
+ }
+ @media #{$mobile} {
+ display: block;
+ .doc {
+ margin: 0;
+ padding: 20px;
+ }
+ .nav {
+ // JS will persistently toggle to .after_first_click. This is to
+ // avoid spurious transitions on page load.
+ display: none;
+
+ --nav-width-mobile: calc(min(90vw, 360px));
+ width: var(--nav-width-mobile);
+ position: fixed;
+ z-index: 2;
+ height: 100vh;
+ overflow-y: auto;
+ top: var(--site-header-height);
+ transition: transform var(--anim-ease) var(--anim-time),
+ box-shadow var(--anim-ease) var(--anim-time),
+ visibility ease var(--anim-time);
+ transform: translateX(calc(-1 * var(--nav-width-mobile)));
+ visibility: hidden;
+ > ul {
+ position: static;
+ top: 0;
+ }
+ &.after_first_click {
display: block;
- .doc {
- margin: 0;
- padding: 20px;
- }
- .nav {
- // JS will persistently toggle to .after_first_click. This is to
- // avoid spurious transitions on page load.
- display: none;
-
- --nav-width-mobile: calc(min(90vw, 360px));
- width: var(--nav-width-mobile);
- position: fixed;
- z-index: 2;
- height: 100vh;
- overflow-y: auto;
- top: var(--site-header-height);
- transition: transform var(--anim-ease) var(--anim-time),
- box-shadow var(--anim-ease) var(--anim-time),
- visibility ease var(--anim-time);
- transform: translateX(calc(-1 * var(--nav-width-mobile)));
- visibility: hidden;
- >ul {
- position: static;
- top: 0;
- }
- &.after_first_click {
- display: block;
- }
- &.expanded {
- visibility: visible;
- transform: translateX(0);
- box-shadow: 0 1px 0 100vw rgba(0,0,0,0.4);
- }
- }
+ }
+ &.expanded {
+ visibility: visible;
+ transform: translateX(0);
+ box-shadow: 0 1px 0 100vw rgba(0, 0, 0, 0.4);
+ }
}
+ }
}
diff --git a/protos/perfetto/metrics/chrome/BUILD.gn b/protos/perfetto/metrics/chrome/BUILD.gn
index bf47885..c0b0c36 100644
--- a/protos/perfetto/metrics/chrome/BUILD.gn
+++ b/protos/perfetto/metrics/chrome/BUILD.gn
@@ -27,6 +27,7 @@
"dropped_frames.proto",
"frame_times.proto",
"histogram_hashes.proto",
+ "histogram_summaries.proto",
"long_latency.proto",
"media_metric.proto",
"performance_mark_hashes.proto",
diff --git a/protos/perfetto/metrics/chrome/all_chrome_metrics.proto b/protos/perfetto/metrics/chrome/all_chrome_metrics.proto
index 596bc7f..ebc0ac5 100644
--- a/protos/perfetto/metrics/chrome/all_chrome_metrics.proto
+++ b/protos/perfetto/metrics/chrome/all_chrome_metrics.proto
@@ -23,6 +23,7 @@
import "protos/perfetto/metrics/chrome/dropped_frames.proto";
import "protos/perfetto/metrics/chrome/frame_times.proto";
import "protos/perfetto/metrics/chrome/histogram_hashes.proto";
+import "protos/perfetto/metrics/chrome/histogram_summaries.proto";
import "protos/perfetto/metrics/chrome/long_latency.proto";
import "protos/perfetto/metrics/chrome/media_metric.proto";
import "protos/perfetto/metrics/chrome/performance_mark_hashes.proto";
@@ -53,4 +54,5 @@
optional ChromeUnsymbolizedArgs chrome_unsymbolized_args = 1014;
optional ChromeArgsClassNames chrome_args_class_names = 1015;
optional ChromeScrollJankV3 chrome_scroll_jank_v3 = 1017;
+ optional ChromeHistogramSummaries chrome_histogram_summaries = 1018;
}
diff --git a/protos/perfetto/metrics/chrome/histogram_summaries.proto b/protos/perfetto/metrics/chrome/histogram_summaries.proto
new file mode 100644
index 0000000..57dad94
--- /dev/null
+++ b/protos/perfetto/metrics/chrome/histogram_summaries.proto
@@ -0,0 +1,43 @@
+
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+
+package perfetto.protos;
+
+message HistogramSummary {
+ // The name of the histogram event
+ optional string name = 1;
+ // The avarage value of the histogram event
+ optional int64 mean = 2;
+ // The number of the histogram event in the trace track
+ optional uint32 count = 3;
+ // The sum of value of the histogram event
+ optional int64 sum = 4;
+ // The maximum value of the histogram event
+ optional int64 max = 5;
+ // The 90 percentile value of the histogram event
+ optional int64 p90 = 6;
+ // The 50 percentile (median) value of the histogram event
+ optional int64 p50 = 7;
+}
+
+// The list of the summary of Chrome Histograms in trace track events.
+// This includes the statistic information of each histograms from Chrome.
+message ChromeHistogramSummaries {
+ repeated HistogramSummary histogram_summary = 1;
+}
diff --git a/protos/perfetto/trace/ftrace/all_protos.gni b/protos/perfetto/trace/ftrace/all_protos.gni
index 7319dd4..8565125 100644
--- a/protos/perfetto/trace/ftrace/all_protos.gni
+++ b/protos/perfetto/trace/ftrace/all_protos.gni
@@ -42,6 +42,7 @@
"fastrpc.proto",
"fence.proto",
"filemap.proto",
+ "fs.proto",
"ftrace.proto",
"g2d.proto",
"google_icc_trace.proto",
diff --git a/protos/perfetto/trace/ftrace/fs.proto b/protos/perfetto/trace/ftrace/fs.proto
new file mode 100644
index 0000000..4cc3531
--- /dev/null
+++ b/protos/perfetto/trace/ftrace/fs.proto
@@ -0,0 +1,15 @@
+// Autogenerated by:
+// ../../src/tools/ftrace_proto_gen/ftrace_proto_gen.cc
+// Do not edit.
+
+syntax = "proto2";
+package perfetto.protos;
+
+message DoSysOpenFtraceEvent {
+ optional string filename = 1;
+ optional int32 flags = 2;
+ optional int32 mode = 3;
+}
+message OpenExecFtraceEvent {
+ optional string filename = 1;
+}
diff --git a/protos/perfetto/trace/ftrace/ftrace_event.proto b/protos/perfetto/trace/ftrace/ftrace_event.proto
index b363eb0..40e7113 100644
--- a/protos/perfetto/trace/ftrace/ftrace_event.proto
+++ b/protos/perfetto/trace/ftrace/ftrace_event.proto
@@ -42,6 +42,7 @@
import "protos/perfetto/trace/ftrace/fastrpc.proto";
import "protos/perfetto/trace/ftrace/fence.proto";
import "protos/perfetto/trace/ftrace/filemap.proto";
+import "protos/perfetto/trace/ftrace/fs.proto";
import "protos/perfetto/trace/ftrace/ftrace.proto";
import "protos/perfetto/trace/ftrace/g2d.proto";
import "protos/perfetto/trace/ftrace/google_icc_trace.proto";
@@ -683,5 +684,7 @@
DevfreqFrequencyFtraceEvent devfreq_frequency = 541;
KprobeEvent kprobe_event = 542;
ParamSetValueCpmFtraceEvent param_set_value_cpm = 543;
+ DoSysOpenFtraceEvent do_sys_open = 544;
+ OpenExecFtraceEvent open_exec = 545;
}
}
diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto
index 5e07a0c..6104064 100644
--- a/protos/perfetto/trace/perfetto_trace.proto
+++ b/protos/perfetto/trace/perfetto_trace.proto
@@ -8805,6 +8805,19 @@
// End of protos/perfetto/trace/ftrace/filemap.proto
+// Begin of protos/perfetto/trace/ftrace/fs.proto
+
+message DoSysOpenFtraceEvent {
+ optional string filename = 1;
+ optional int32 flags = 2;
+ optional int32 mode = 3;
+}
+message OpenExecFtraceEvent {
+ optional string filename = 1;
+}
+
+// End of protos/perfetto/trace/ftrace/fs.proto
+
// Begin of protos/perfetto/trace/ftrace/ftrace.proto
message PrintFtraceEvent {
@@ -11424,6 +11437,8 @@
DevfreqFrequencyFtraceEvent devfreq_frequency = 541;
KprobeEvent kprobe_event = 542;
ParamSetValueCpmFtraceEvent param_set_value_cpm = 543;
+ DoSysOpenFtraceEvent do_sys_open = 544;
+ OpenExecFtraceEvent open_exec = 545;
}
}
diff --git a/protos/perfetto/trace_processor/trace_processor.proto b/protos/perfetto/trace_processor/trace_processor.proto
index bfb2a1f..86b4918 100644
--- a/protos/perfetto/trace_processor/trace_processor.proto
+++ b/protos/perfetto/trace_processor/trace_processor.proto
@@ -155,6 +155,8 @@
StatusResult status = 210;
// For TPM_REGISTER_SQL_PACKAGE.
RegisterSqlPackageResult register_sql_package_result = 211;
+ // For TPM_FINALIZE_TRACE_DATA.
+ FinalizeDataResult finalize_data_result = 212;
}
// Previously: RawQueryArgs for TPM_QUERY_RAW_DEPRECATED
@@ -356,4 +358,8 @@
message RegisterSqlPackageResult {
optional string error = 1;
-}
\ No newline at end of file
+}
+
+message FinalizeDataResult {
+ optional string error = 1;
+}
diff --git a/protos/third_party/chromium/chrome_track_event.proto b/protos/third_party/chromium/chrome_track_event.proto
index 7cf29f6..6d92cb6 100644
--- a/protos/third_party/chromium/chrome_track_event.proto
+++ b/protos/third_party/chromium/chrome_track_event.proto
@@ -2020,6 +2020,15 @@
// Timestamp in microseconds of the start of the task containing this slice.
optional uint64 task_start_time_us = 2;
+
+ // t1 - t0, where t1 is the start timestamp of this slice and t0 is the
+ // timestamp of the time when the task containing this slice
+ // was queued.
+ optional uint64 task_queueing_time_us = 3;
+
+ // Timestamp in microseconds of the time when the task containing
+ // this slice was queued.
+ optional uint64 task_queued_time_us = 4;
}
message ChromeLatencyInfo2 {
diff --git a/python/perfetto/trace_processor/trace_processor.descriptor b/python/perfetto/trace_processor/trace_processor.descriptor
index 976fb9b..40cec35 100644
--- a/python/perfetto/trace_processor/trace_processor.descriptor
+++ b/python/perfetto/trace_processor/trace_processor.descriptor
Binary files differ
diff --git a/python/tools/check_ratchet.py b/python/tools/check_ratchet.py
index d53b0c3..a34ff08 100755
--- a/python/tools/check_ratchet.py
+++ b/python/tools/check_ratchet.py
@@ -36,7 +36,7 @@
from dataclasses import dataclass
-EXPECTED_ANY_COUNT = 52
+EXPECTED_ANY_COUNT = 51
EXPECTED_RUN_METRIC_COUNT = 4
ROOT_DIR = os.path.dirname(
diff --git a/src/base/time.cc b/src/base/time.cc
index e799542..ad971af 100644
--- a/src/base/time.cc
+++ b/src/base/time.cc
@@ -188,10 +188,15 @@
std::string GetTimeFmt(const std::string& fmt) {
time_t raw_time;
time(&raw_time);
- struct tm* local_tm;
- local_tm = localtime(&raw_time);
+ struct tm local_tm;
+#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
+ PERFETTO_CHECK(localtime_s(&local_tm, &raw_time) == 0);
+#else
+ tzset();
+ PERFETTO_CHECK(localtime_r(&raw_time, &local_tm) != nullptr);
+#endif
char buf[128];
- PERFETTO_CHECK(strftime(buf, 80, fmt.c_str(), local_tm) > 0);
+ PERFETTO_CHECK(strftime(buf, 80, fmt.c_str(), &local_tm) > 0);
return buf;
}
diff --git a/src/profiling/memory/client_api_factory_android.cc b/src/profiling/memory/client_api_factory_android.cc
index 9c7b63c..fe5318f 100644
--- a/src/profiling/memory/client_api_factory_android.cc
+++ b/src/profiling/memory/client_api_factory_android.cc
@@ -46,7 +46,7 @@
std::optional<perfetto::base::UnixSocketRaw> sock =
Client::ConnectToHeapprofd(perfetto::profiling::kHeapprofdSocketFile);
if (!sock) {
- PERFETTO_ELOG("Failed to connect to %s. This is benign on user builds.",
+ PERFETTO_ELOG("Failed to connect to %s.",
perfetto::profiling::kHeapprofdSocketFile);
return nullptr;
}
diff --git a/src/tools/ftrace_proto_gen/event_list b/src/tools/ftrace_proto_gen/event_list
index 8c99f49..7eeadfb 100644
--- a/src/tools/ftrace_proto_gen/event_list
+++ b/src/tools/ftrace_proto_gen/event_list
@@ -537,3 +537,5 @@
sched/sched_wakeup_task_attr
devfreq/devfreq_frequency
cpm_trace/param_set_value_cpm
+fs/do_sys_open
+fs/open_exec
diff --git a/src/trace_processor/importers/ftrace/ftrace_descriptors.cc b/src/trace_processor/importers/ftrace/ftrace_descriptors.cc
index 53085f9..c9d3970 100644
--- a/src/trace_processor/importers/ftrace/ftrace_descriptors.cc
+++ b/src/trace_processor/importers/ftrace/ftrace_descriptors.cc
@@ -24,7 +24,7 @@
namespace trace_processor {
namespace {
-std::array<FtraceMessageDescriptor, 544> descriptors{{
+std::array<FtraceMessageDescriptor, 546> descriptors{{
{nullptr, 0, {}},
{nullptr, 0, {}},
{nullptr, 0, {}},
@@ -6016,6 +6016,24 @@
{"timestamp", ProtoSchemaType::kInt64},
},
},
+ {
+ "do_sys_open",
+ 3,
+ {
+ {},
+ {"filename", ProtoSchemaType::kString},
+ {"flags", ProtoSchemaType::kInt32},
+ {"mode", ProtoSchemaType::kInt32},
+ },
+ },
+ {
+ "open_exec",
+ 1,
+ {
+ {},
+ {"filename", ProtoSchemaType::kString},
+ },
+ },
}};
} // namespace
diff --git a/src/trace_processor/importers/proto/android_probes_parser.cc b/src/trace_processor/importers/proto/android_probes_parser.cc
index 2da16c9..7c3e9f9 100644
--- a/src/trace_processor/importers/proto/android_probes_parser.cc
+++ b/src/trace_processor/importers/proto/android_probes_parser.cc
@@ -147,8 +147,10 @@
TrackTracker::Group::kPower, batt_power_id);
auto current = evt.current_ua();
auto voltage = evt.voltage_uv();
- context_->event_tracker->PushCounter(
- ts, static_cast<double>(current * voltage / 1000000000), track);
+ // Current is negative when discharging, but we want the power counter to
+ // always be positive, so take the absolute value.
+ auto power = std::abs(static_cast<double>(current * voltage / 1000000000));
+ context_->event_tracker->PushCounter(ts, power, track);
}
}
diff --git a/src/trace_processor/metrics/sql/chrome/BUILD.gn b/src/trace_processor/metrics/sql/chrome/BUILD.gn
index 30962b8..7d10aeb 100644
--- a/src/trace_processor/metrics/sql/chrome/BUILD.gn
+++ b/src/trace_processor/metrics/sql/chrome/BUILD.gn
@@ -26,6 +26,7 @@
"chrome_args_class_names.sql",
"chrome_event_metadata.sql",
"chrome_histogram_hashes.sql",
+ "chrome_histogram_summaries.sql",
"chrome_input_to_browser_intervals.sql",
"chrome_input_to_browser_intervals_base.sql",
"chrome_input_to_browser_intervals_template.sql",
diff --git a/src/trace_processor/metrics/sql/chrome/chrome_histogram_summaries.sql b/src/trace_processor/metrics/sql/chrome/chrome_histogram_summaries.sql
new file mode 100644
index 0000000..7946491
--- /dev/null
+++ b/src/trace_processor/metrics/sql/chrome/chrome_histogram_summaries.sql
@@ -0,0 +1,49 @@
+--
+-- Copyright 2024 The Android Open Source Project
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- https://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+INCLUDE PERFETTO MODULE chrome.histograms;
+
+DROP VIEW IF EXISTS HistogramSummaryTable;
+CREATE PERFETTO VIEW HistogramSummaryTable AS
+SELECT
+ hist.name AS histname,
+ CAST(AVG(hist.value) AS INTEGER) AS mean_histval,
+ COUNT(*) AS hist_count,
+ CAST(SUM(hist.value) AS INTEGER) AS sum_histval,
+ CAST(MAX(hist.value) AS INTEGER) AS max_histval,
+ CAST(PERCENTILE(hist.value, 90) AS INTEGER) AS p90_histval,
+ CAST(PERCENTILE(hist.value, 50) AS INTEGER) AS p50_histval
+FROM chrome_histograms hist
+GROUP BY hist.name;
+
+DROP VIEW IF EXISTS chrome_histogram_summaries_output;
+CREATE PERFETTO VIEW chrome_histogram_summaries_output AS
+SELECT ChromeHistogramSummaries(
+ 'histogram_summary', (
+ SELECT RepeatedField(
+ HistogramSummary(
+ 'name', histname,
+ 'mean', mean_histval,
+ 'count', hist_count,
+ 'sum', sum_histval,
+ 'max', max_histval,
+ 'p90', p90_histval,
+ 'p50', p50_histval
+ )
+ )
+ FROM HistogramSummaryTable
+ )
+);
diff --git a/src/trace_processor/perfetto_sql/stdlib/sched/BUILD.gn b/src/trace_processor/perfetto_sql/stdlib/sched/BUILD.gn
index d7e9608..3a2ccbe 100644
--- a/src/trace_processor/perfetto_sql/stdlib/sched/BUILD.gn
+++ b/src/trace_processor/perfetto_sql/stdlib/sched/BUILD.gn
@@ -16,6 +16,7 @@
perfetto_sql_source_set("sched") {
sources = [
+ "latency.sql",
"runnable.sql",
"states.sql",
"thread_executing_span.sql",
diff --git a/src/trace_processor/perfetto_sql/stdlib/sched/latency.sql b/src/trace_processor/perfetto_sql/stdlib/sched/latency.sql
new file mode 100644
index 0000000..50dd7e7
--- /dev/null
+++ b/src/trace_processor/perfetto_sql/stdlib/sched/latency.sql
@@ -0,0 +1,51 @@
+--
+-- Copyright 2024 The Android Open Source Project
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- https://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+INCLUDE PERFETTO MODULE sched.runnable;
+
+CREATE PERFETTO VIEW _sched_with_thread_state_join AS
+SELECT
+ thread_state.id AS thread_state_id,
+ sched.id AS sched_id
+FROM sched
+JOIN thread_state USING (utid, ts, dur);
+
+-- Scheduling latency of running thread states.
+-- For each time the thread was running, returns the duration of the runnable
+-- state directly before.
+CREATE PERFETTO TABLE sched_latency_for_running_interval(
+ -- Running state of the thread. Alias of `thread_state.id`.
+ thread_state_id INT,
+ -- Id of a corresponding slice in a `sched` table. Alias of `sched.id`.
+ sched_id INT,
+ -- Thread with running state. Alias of `thread.id`.
+ utid INT,
+ -- Runnable state before thread is "running". Duration of this thread state
+ -- is `latency_dur`. One of `thread_state.id`.
+ runnable_latency_id INT,
+ -- Scheduling latency of thread state. Duration of thread state with
+ -- `runnable_latency_id`.
+ latency_dur INT
+) AS
+SELECT
+ r.id AS thread_state_id,
+ sched_id,
+ utid,
+ prev_runnable_id AS runnable_latency_id,
+ dur AS latency_dur
+FROM sched_previous_runnable_on_thread r
+JOIN thread_state prev_ts ON prev_runnable_id = prev_ts.id
+JOIN _sched_with_thread_state_join ON thread_state_id = r.id
+
diff --git a/src/trace_processor/perfetto_sql/stdlib/sched/runnable.sql b/src/trace_processor/perfetto_sql/stdlib/sched/runnable.sql
index 38956b1..ffe8b55 100644
--- a/src/trace_processor/perfetto_sql/stdlib/sched/runnable.sql
+++ b/src/trace_processor/perfetto_sql/stdlib/sched/runnable.sql
@@ -19,12 +19,12 @@
-- - previous "Runnable" (or runnable preempted) state.
-- - previous uninterrupted "Runnable" state with a valid waker thread.
CREATE PERFETTO TABLE sched_previous_runnable_on_thread(
- -- `thread_state.id` id.
+ -- Alias of `thread_state.id`.
id INT,
- -- Previous runnable `thread_state.id`.
+ -- Previous runnable thread state. Alias of `thread_state.id`.
prev_runnable_id INT,
- -- Previous runnable `thread_state.id` with valid waker
- -- thread.
+ -- Previous runnable thread state with valid waker thread. Alias of
+ -- `thread_state.id`.
prev_wakeup_runnable_id INT
) AS
WITH running_and_runnable AS (
diff --git a/src/trace_processor/rpc/rpc.cc b/src/trace_processor/rpc/rpc.cc
index 49feef3..d26cdc1 100644
--- a/src/trace_processor/rpc/rpc.cc
+++ b/src/trace_processor/rpc/rpc.cc
@@ -212,7 +212,11 @@
}
case RpcProto::TPM_FINALIZE_TRACE_DATA: {
Response resp(tx_seq_id_++, req_type);
- NotifyEndOfFile();
+ auto* result = resp->set_finalize_data_result();
+ base::Status res = NotifyEndOfFile();
+ if (!res.ok()) {
+ result->set_error(res.message());
+ }
resp.Send(rpc_response_fn_);
break;
}
diff --git a/src/traced/probes/ftrace/event_info.cc b/src/traced/probes/ftrace/event_info.cc
index 2cd9b20..f93e6e4 100644
--- a/src/traced/probes/ftrace/event_info.cc
+++ b/src/traced/probes/ftrace/event_info.cc
@@ -5045,6 +5045,32 @@
kUnsetFtraceId,
98,
kUnsetSize},
+ {"do_sys_open",
+ "fs",
+ {
+ {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+ "filename", 1, ProtoSchemaType::kString,
+ TranslationStrategy::kInvalidTranslationStrategy},
+ {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+ "flags", 2, ProtoSchemaType::kInt32,
+ TranslationStrategy::kInvalidTranslationStrategy},
+ {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+ "mode", 3, ProtoSchemaType::kInt32,
+ TranslationStrategy::kInvalidTranslationStrategy},
+ },
+ kUnsetFtraceId,
+ 544,
+ kUnsetSize},
+ {"open_exec",
+ "fs",
+ {
+ {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+ "filename", 1, ProtoSchemaType::kString,
+ TranslationStrategy::kInvalidTranslationStrategy},
+ },
+ kUnsetFtraceId,
+ 545,
+ kUnsetSize},
{"print",
"ftrace",
{
diff --git a/src/traced/probes/ftrace/test/data/synthetic/events/fs/do_sys_open/format b/src/traced/probes/ftrace/test/data/synthetic/events/fs/do_sys_open/format
new file mode 100644
index 0000000..d6bac92
--- /dev/null
+++ b/src/traced/probes/ftrace/test/data/synthetic/events/fs/do_sys_open/format
@@ -0,0 +1,13 @@
+name: do_sys_open
+ID: 685
+format:
+ field:unsigned short common_type; offset:0; size:2; signed:0;
+ field:unsigned char common_flags; offset:2; size:1; signed:0;
+ field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
+ field:int common_pid; offset:4; size:4; signed:1;
+
+ field:__data_loc char[] filename; offset:8; size:4; signed:1;
+ field:int flags; offset:12; size:4; signed:1;
+ field:int mode; offset:16; size:4; signed:1;
+
+print fmt: ""%s" %x %o", __get_str(filename), REC->flags, REC->mode
diff --git a/src/traced/probes/ftrace/test/data/synthetic/events/fs/open_exec/format b/src/traced/probes/ftrace/test/data/synthetic/events/fs/open_exec/format
new file mode 100644
index 0000000..9f6fe3d
--- /dev/null
+++ b/src/traced/probes/ftrace/test/data/synthetic/events/fs/open_exec/format
@@ -0,0 +1,11 @@
+name: open_exec
+ID: 686
+format:
+ field:unsigned short common_type; offset:0; size:2; signed:0;
+ field:unsigned char common_flags; offset:2; size:1; signed:0;
+ field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
+ field:int common_pid; offset:4; size:4; signed:1;
+
+ field:__data_loc char[] filename; offset:8; size:4; signed:1;
+
+print fmt: ""%s"", __get_str(filename)
diff --git a/test/data/ui-screenshots/ftrace_tracks_and_tab.test.ts/ftrace-tracks/ftrace-events.png.sha256 b/test/data/ui-screenshots/ftrace_tracks_and_tab.test.ts/ftrace-tracks/ftrace-events.png.sha256
index b97e598..66f89fe 100644
--- a/test/data/ui-screenshots/ftrace_tracks_and_tab.test.ts/ftrace-tracks/ftrace-events.png.sha256
+++ b/test/data/ui-screenshots/ftrace_tracks_and_tab.test.ts/ftrace-tracks/ftrace-events.png.sha256
@@ -1 +1 @@
-ef239fe1e10e3b830f7adf9b5b8f96a52c69a50e6d879cfb5a873cd26caab769
\ No newline at end of file
+ae6623f3d00536a815ad76c40c5933845a436e6e8acee6349d0e925c06d0b6b0
\ No newline at end of file
diff --git a/test/trace_processor/diff_tests/parser/power/tests_linux_sysfs_power.py b/test/trace_processor/diff_tests/parser/power/tests_linux_sysfs_power.py
index 046d1c4..ccdae4f 100644
--- a/test/trace_processor/diff_tests/parser/power/tests_linux_sysfs_power.py
+++ b/test/trace_processor/diff_tests/parser/power/tests_linux_sysfs_power.py
@@ -147,7 +147,7 @@
packet {
timestamp: 4000000
battery {
- current_ua: 510000
+ current_ua: -510000
voltage_uv: 12000000
}
}
diff --git a/test/trace_processor/diff_tests/stdlib/sched/tests.py b/test/trace_processor/diff_tests/stdlib/sched/tests.py
index 1de62b5..a327125 100644
--- a/test/trace_processor/diff_tests/stdlib/sched/tests.py
+++ b/test/trace_processor/diff_tests/stdlib/sched/tests.py
@@ -187,3 +187,33 @@
538177,537492,537492
538175,538174,524613
"""))
+
+ def test_sched_latency(self):
+ return DiffTestBlueprint(
+ trace=DataPath('android_boot.pftrace'),
+ query="""
+ INCLUDE PERFETTO MODULE sched.latency;
+
+ SELECT
+ thread_state_id,
+ sched_id,
+ utid,
+ runnable_latency_id,
+ latency_dur
+ FROM sched_latency_for_running_interval
+ ORDER BY thread_state_id DESC
+ LIMIT 10;
+ """,
+ out=Csv("""
+ "thread_state_id","sched_id","utid","runnable_latency_id","latency_dur"
+ 538199,269427,2,538191,91919
+ 538197,269425,2,538191,91919
+ 538195,269423,2,538191,91919
+ 538190,269422,1330,538136,1437215
+ 538188,269420,2,538088,826823
+ 538184,269419,91,538176,131388
+ 538181,269418,319,538178,4883
+ 538179,269417,1022,524619,469849
+ 538177,269416,319,537492,670736
+ 538175,269415,91,538174,12532
+ """))
diff --git a/tools/gen_android_bp b/tools/gen_android_bp
index f5386dc..71340c9 100755
--- a/tools/gen_android_bp
+++ b/tools/gen_android_bp
@@ -302,6 +302,13 @@
],
'libperfetto': [('export_include_dirs', {'include', buildflags_dir}),],
'perfetto': [('required', {'perfetto_persistent_cfg.pbtxt'}),],
+ 'trace_redactor': [
+ ('min_sdk_version', '35'),
+ ('apex_available', {
+ '//apex_available:platform',
+ 'com.android.profiling'
+ }),
+ ],
}
diff --git a/ui/src/core/app_impl.ts b/ui/src/core/app_impl.ts
index 7662755..c1045e2 100644
--- a/ui/src/core/app_impl.ts
+++ b/ui/src/core/app_impl.ts
@@ -214,8 +214,8 @@
return this.appCtx.currentTrace?.forPlugin(this.pluginId);
}
- scheduleFullRedraw(): void {
- raf.scheduleFullRedraw();
+ scheduleFullRedraw(force?: 'force'): void {
+ raf.scheduleFullRedraw(force);
}
get httpRpc() {
diff --git a/ui/src/core/command_manager.ts b/ui/src/core/command_manager.ts
index fdf6ee6..ad0f482 100644
--- a/ui/src/core/command_manager.ts
+++ b/ui/src/core/command_manager.ts
@@ -15,6 +15,7 @@
import {FuzzyFinder, FuzzySegment} from '../base/fuzzy';
import {Registry} from '../base/registry';
import {Command, CommandManager} from '../public/command';
+import {raf} from './raf_scheduler';
export interface CommandWithMatchInfo extends Command {
segments: FuzzySegment[];
@@ -39,10 +40,11 @@
return this.registry.register(cmd);
}
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- runCommand(id: string, ...args: any[]): any {
+ runCommand(id: string, ...args: unknown[]): unknown {
const cmd = this.registry.get(id);
- return cmd.callback(...args);
+ const res = cmd.callback(...args);
+ Promise.resolve(res).finally(() => raf.scheduleFullRedraw('force'));
+ return res;
}
// Returns a list of commands that match the search term, along with a list
diff --git a/ui/src/core/load_trace.ts b/ui/src/core/load_trace.ts
index c39245f..41196c7 100644
--- a/ui/src/core/load_trace.ts
+++ b/ui/src/core/load_trace.ts
@@ -147,7 +147,7 @@
ftraceDropUntilAllCpusValid: FTRACE_DROP_UNTIL_FLAG.get(),
});
}
- engine.onResponseReceived = () => raf.scheduleFullRedraw();
+ engine.onResponseReceived = () => raf.scheduleFullRedraw('force');
if (isMetatracingEnabled()) {
engine.enableMetatrace(assertExists(getEnabledMetatracingCategories()));
diff --git a/ui/src/core/raf_scheduler.ts b/ui/src/core/raf_scheduler.ts
index b23379f..2935963 100644
--- a/ui/src/core/raf_scheduler.ts
+++ b/ui/src/core/raf_scheduler.ts
@@ -13,10 +13,19 @@
// limitations under the License.
import {PerfStats} from './perf_stats';
+import m from 'mithril';
+import {featureFlags} from './feature_flags';
export type AnimationCallback = (lastFrameMs: number) => void;
export type RedrawCallback = () => void;
+export const AUTOREDRAW_FLAG = featureFlags.register({
+ id: 'mithrilAutoredraw',
+ name: 'Enable Mithril autoredraw',
+ description: 'Turns calls to schedulefullRedraw() a no-op',
+ defaultValue: false,
+});
+
// This class orchestrates all RAFs in the UI. It ensures that there is only
// one animation frame handler overall and that callbacks are called in
// predictable order. There are two types of callbacks here:
@@ -34,12 +43,12 @@
// These happen at the end of full (DOM) animation frames.
private postRedrawCallbacks = new Array<RedrawCallback>();
- private syncDomRedrawFn: () => void = () => {};
private hasScheduledNextFrame = false;
private requestedFullRedraw = false;
private isRedrawing = false;
private _shutdown = false;
private recordPerfStats = false;
+ private mounts = new Map<Element, m.ComponentTypes>();
readonly perfStats = {
rafActions: new PerfStats(),
@@ -49,16 +58,23 @@
domRedraw: new PerfStats(),
};
- // Called by frontend/index.ts. syncDomRedrawFn is a function that invokes
- // m.render() of the root UiMain component.
- initialize(syncDomRedrawFn: () => void) {
- this.syncDomRedrawFn = syncDomRedrawFn;
+ constructor() {
+ // Patch m.redraw() to our RAF full redraw.
+ const origSync = m.redraw.sync;
+ const redrawFn = () => this.scheduleFullRedraw('force');
+ redrawFn.sync = origSync;
+ m.redraw = redrawFn;
+
+ m.mount = this.mount.bind(this);
}
// Schedule re-rendering of virtual DOM and canvas.
// If a callback is passed it will be executed after the DOM redraw has
// completed.
- scheduleFullRedraw(cb?: RedrawCallback) {
+ scheduleFullRedraw(force?: 'force', cb?: RedrawCallback) {
+ // If we are using autoredraw mode, make this function a no-op unless
+ // 'force' is passed.
+ if (AUTOREDRAW_FLAG.get() && force !== 'force') return;
this.requestedFullRedraw = true;
cb && this.postRedrawCallbacks.push(cb);
this.maybeScheduleAnimationFrame(true);
@@ -88,6 +104,16 @@
};
}
+ mount(element: Element, component: m.ComponentTypes | null): void {
+ const mounts = this.mounts;
+ if (component === null) {
+ mounts.delete(element);
+ } else {
+ mounts.set(element, component);
+ }
+ this.syncDomRedrawMountEntry(element, component);
+ }
+
shutdown() {
this._shutdown = true;
}
@@ -103,12 +129,37 @@
private syncDomRedraw() {
const redrawStart = performance.now();
- this.syncDomRedrawFn();
+
+ for (const [element, component] of this.mounts.entries()) {
+ this.syncDomRedrawMountEntry(element, component);
+ }
+
if (this.recordPerfStats) {
this.perfStats.domRedraw.addValue(performance.now() - redrawStart);
}
}
+ private syncDomRedrawMountEntry(
+ element: Element,
+ component: m.ComponentTypes | null,
+ ) {
+ // Mithril's render() function takes a third argument which tells us if a
+ // further redraw is needed (e.g. due to managed event handler). This allows
+ // us to implement auto-redraw. The redraw argument is documented in the
+ // official Mithril docs but is just not part of the @types/mithril package.
+ const mithrilRender = m.render as (
+ el: Element,
+ vnodes: m.Children,
+ redraw?: () => void,
+ ) => void;
+
+ mithrilRender(
+ element,
+ component !== null ? m(component) : null,
+ AUTOREDRAW_FLAG.get() ? () => raf.scheduleFullRedraw('force') : undefined,
+ );
+ }
+
private syncCanvasRedraw() {
const redrawStart = performance.now();
if (this.isRedrawing) return;
diff --git a/ui/src/frontend/base_slice_track.ts b/ui/src/frontend/base_slice_track.ts
index 0ca6c01..0c18970 100644
--- a/ui/src/frontend/base_slice_track.ts
+++ b/ui/src/frontend/base_slice_track.ts
@@ -35,6 +35,7 @@
import {TrackMouseEvent, TrackRenderContext} from '../public/track';
import {Point2D, VerticalBounds} from '../base/geom';
import {Trace} from '../public/trace';
+import {SourceDataset, Dataset} from '../trace_processor/dataset';
// The common class that underpins all tracks drawing slices.
@@ -972,6 +973,17 @@
});
return {ts: Time.fromRaw(row.ts), dur: Duration.fromRaw(row.dur)};
}
+
+ getDataset(): Dataset | undefined {
+ return new SourceDataset({
+ src: this.getSqlSource(),
+ schema: {
+ id: NUM,
+ ts: LONG,
+ dur: LONG,
+ },
+ });
+ }
}
// This is the argument passed to onSliceOver(args).
diff --git a/ui/src/frontend/error_dialog.ts b/ui/src/frontend/error_dialog.ts
index 99d4157..3e27b07 100644
--- a/ui/src/frontend/error_dialog.ts
+++ b/ui/src/frontend/error_dialog.ts
@@ -242,7 +242,7 @@
this.uploadStatus = '';
const uploader = new GcsUploader(this.traceData, {
onProgress: () => {
- raf.scheduleFullRedraw();
+ raf.scheduleFullRedraw('force');
this.uploadStatus = uploader.getEtaString();
if (uploader.state === 'UPLOADED') {
this.traceState = 'UPLOADED';
diff --git a/ui/src/frontend/help_modal.ts b/ui/src/frontend/help_modal.ts
index 819f271..322748e 100644
--- a/ui/src/frontend/help_modal.ts
+++ b/ui/src/frontend/help_modal.ts
@@ -54,7 +54,7 @@
nativeKeyboardLayoutMap()
.then((keyMap: KeyboardLayoutMap) => {
this.keyMap = keyMap;
- AppImpl.instance.scheduleFullRedraw();
+ AppImpl.instance.scheduleFullRedraw('force');
})
.catch((e) => {
if (
@@ -69,7 +69,7 @@
// The alternative would be to show key mappings for all keyboard
// layouts which is not feasible.
this.keyMap = new EnglishQwertyKeyboardLayoutMap();
- AppImpl.instance.scheduleFullRedraw();
+ AppImpl.instance.scheduleFullRedraw('force');
} else {
// Something unexpected happened. Either the browser doesn't conform
// to the keyboard API spec, or the keyboard API spec has changed!
diff --git a/ui/src/frontend/index.ts b/ui/src/frontend/index.ts
index 4c87e4d..600f08b 100644
--- a/ui/src/frontend/index.ts
+++ b/ui/src/frontend/index.ts
@@ -63,7 +63,7 @@
});
function routeChange(route: Route) {
- raf.scheduleFullRedraw(() => {
+ raf.scheduleFullRedraw('force', () => {
if (route.fragment) {
// This needs to happen after the next redraw call. It's not enough
// to use setTimeout(..., 0); since that may occur before the
@@ -148,7 +148,7 @@
});
// Wire up raf for widgets.
- setScheduleFullRedraw(() => raf.scheduleFullRedraw());
+ setScheduleFullRedraw((force?: 'force') => raf.scheduleFullRedraw(force));
// Load the css. The load is asynchronous and the CSS is not ready by the time
// appendChild returns.
@@ -225,12 +225,8 @@
const router = new Router();
router.onRouteChanged = routeChange;
- raf.initialize(() =>
- m.render(
- document.body,
- m(UiMain, pages.renderPageForCurrentRoute(AppImpl.instance.trace)),
- ),
- );
+ // Mount the main mithril component. This also forces a sync render pass.
+ raf.mount(document.body, UiMain);
if (
(location.origin.startsWith('http://localhost:') ||
@@ -269,12 +265,6 @@
routeChange(route);
});
- // Force one initial render to get everything in place
- m.render(
- document.body,
- m(UiMain, AppImpl.instance.pages.renderPageForCurrentRoute(undefined)),
- );
-
// Initialize plugins, now that we are ready to go.
const pluginManager = AppImpl.instance.plugins;
CORE_PLUGINS.forEach((p) => pluginManager.registerPlugin(p));
diff --git a/ui/src/frontend/named_slice_track.ts b/ui/src/frontend/named_slice_track.ts
index ed9b5f0..7a23285 100644
--- a/ui/src/frontend/named_slice_track.ts
+++ b/ui/src/frontend/named_slice_track.ts
@@ -16,7 +16,7 @@
import {TrackEventDetailsPanel} from '../public/details_panel';
import {TrackEventSelection} from '../public/selection';
import {Slice} from '../public/track';
-import {STR_NULL} from '../trace_processor/query_result';
+import {LONG, NUM, STR, STR_NULL} from '../trace_processor/query_result';
import {
BASE_ROW,
BaseSliceTrack,
@@ -30,6 +30,7 @@
import {renderDuration} from './widgets/duration';
import {TraceImpl} from '../core/trace_impl';
import {assertIsInstance} from '../base/logging';
+import {SourceDataset, Dataset} from '../trace_processor/dataset';
export const NAMED_ROW = {
// Base columns (tsq, ts, dur, id, depth).
@@ -80,4 +81,16 @@
// because this class is exposed to plugins (which see only Trace).
return new ThreadSliceDetailsPanel(assertIsInstance(this.trace, TraceImpl));
}
+
+ override getDataset(): Dataset | undefined {
+ return new SourceDataset({
+ src: this.getSqlSource(),
+ schema: {
+ id: NUM,
+ name: STR,
+ ts: LONG,
+ dur: LONG,
+ },
+ });
+ }
}
diff --git a/ui/src/frontend/omnibox.ts b/ui/src/frontend/omnibox.ts
index 5f1e29a..c94ee3f 100644
--- a/ui/src/frontend/omnibox.ts
+++ b/ui/src/frontend/omnibox.ts
@@ -328,7 +328,13 @@
document.removeEventListener('mousedown', this.onMouseDown);
}
+ // This is defined as an arrow function to have a single handler that can be
+ // added/remove while keeping `this` bound.
private onMouseDown = (e: Event) => {
+ // We need to schedule a redraw manually as this event handler was added
+ // manually to the DOM and doesn't use Mithril's auto-redraw system.
+ raf.scheduleFullRedraw('force');
+
// Don't close if the click was within ourselves or our popup.
if (e.target instanceof Node) {
if (this.popupElement && this.popupElement.contains(e.target)) {
diff --git a/ui/src/frontend/sidebar.ts b/ui/src/frontend/sidebar.ts
index 8ece2d3..9c03eb7 100644
--- a/ui/src/frontend/sidebar.ts
+++ b/ui/src/frontend/sidebar.ts
@@ -352,7 +352,9 @@
}
export class Sidebar implements m.ClassComponent<OptionalTraceImplAttrs> {
- private _redrawWhileAnimating = new Animation(() => raf.scheduleFullRedraw());
+ private _redrawWhileAnimating = new Animation(() =>
+ raf.scheduleFullRedraw('force'),
+ );
private _asyncJobPending = new Set<string>();
private _sectionExpanded = new Map<string, boolean>();
@@ -523,7 +525,7 @@
raf.scheduleFullRedraw();
res.finally(() => {
this._asyncJobPending.delete(itemId);
- raf.scheduleFullRedraw();
+ raf.scheduleFullRedraw('force');
});
};
}
diff --git a/ui/src/frontend/tab_panel.ts b/ui/src/frontend/tab_panel.ts
index 0662ef8..04aee7e 100644
--- a/ui/src/frontend/tab_panel.ts
+++ b/ui/src/frontend/tab_panel.ts
@@ -163,7 +163,7 @@
/* onDrag */ (_x, y) => {
const deltaYSinceDragStart = dragStartY - y;
this.resizableHeight = heightWhenDragStarted + deltaYSinceDragStart;
- raf.scheduleFullRedraw();
+ raf.scheduleFullRedraw('force');
},
/* onDragStarted */ (_x, y) => {
this.resizableHeight = this.height;
diff --git a/ui/src/frontend/ui_main.ts b/ui/src/frontend/ui_main.ts
index c67f5b7..b8d8dda 100644
--- a/ui/src/frontend/ui_main.ts
+++ b/ui/src/frontend/ui_main.ts
@@ -52,9 +52,9 @@
// This wrapper creates a new instance of UiMainPerTrace for each new trace
// loaded (including the case of no trace at the beginning).
export class UiMain implements m.ClassComponent {
- view({children}: m.CVnode) {
+ view() {
const currentTraceId = AppImpl.instance.trace?.engine.engineId ?? '';
- return [m(UiMainPerTrace, {key: currentTraceId}, children)];
+ return [m(UiMainPerTrace, {key: currentTraceId})];
}
}
@@ -629,12 +629,13 @@
this.maybeFocusOmnibar();
}
- view({children}: m.Vnode): m.Children {
+ view(): m.Children {
+ const app = AppImpl.instance;
const hotkeys: HotkeyConfig[] = [];
- for (const {id, defaultHotkey} of AppImpl.instance.commands.commands) {
+ for (const {id, defaultHotkey} of app.commands.commands) {
if (defaultHotkey) {
hotkeys.push({
- callback: () => AppImpl.instance.commands.runCommand(id),
+ callback: () => app.commands.runCommand(id),
hotkey: defaultHotkey,
});
}
@@ -650,10 +651,10 @@
omnibox: this.renderOmnibox(),
trace: this.trace,
}),
- children,
+ app.pages.renderPageForCurrentRoute(app.trace),
m(CookieConsent),
maybeRenderFullscreenModalDialog(),
- AppImpl.instance.perfDebugging.renderPerfStats(),
+ app.perfDebugging.renderPerfStats(),
),
);
}
diff --git a/ui/src/plugins/dev.perfetto.AsyncSlices/async_slice_track.ts b/ui/src/plugins/dev.perfetto.AsyncSlices/async_slice_track.ts
index 1bb31a5..0486e6e 100644
--- a/ui/src/plugins/dev.perfetto.AsyncSlices/async_slice_track.ts
+++ b/ui/src/plugins/dev.perfetto.AsyncSlices/async_slice_track.ts
@@ -19,7 +19,14 @@
import {NewTrackArgs} from '../../frontend/track';
import {TrackEventDetails} from '../../public/selection';
import {Slice} from '../../public/track';
-import {LONG_NULL} from '../../trace_processor/query_result';
+import {SourceDataset, Dataset} from '../../trace_processor/dataset';
+import {
+ LONG,
+ LONG_NULL,
+ NUM,
+ NUM_NULL,
+ STR,
+} from '../../trace_processor/query_result';
export const THREAD_SLICE_ROW = {
// Base columns (tsq, ts, dur, id, depth).
@@ -104,4 +111,21 @@
tableName: 'slice',
};
}
+
+ override getDataset(): Dataset {
+ return new SourceDataset({
+ src: `slice`,
+ filter: {
+ col: 'track_id',
+ in: this.trackIds,
+ },
+ schema: {
+ id: NUM,
+ name: STR,
+ ts: LONG,
+ dur: LONG,
+ parent_id: NUM_NULL,
+ },
+ });
+ }
}
diff --git a/ui/src/plugins/dev.perfetto.AsyncSlices/slice_selection_aggregator.ts b/ui/src/plugins/dev.perfetto.AsyncSlices/slice_selection_aggregator.ts
index 55f7c95..23226bc 100644
--- a/ui/src/plugins/dev.perfetto.AsyncSlices/slice_selection_aggregator.ts
+++ b/ui/src/plugins/dev.perfetto.AsyncSlices/slice_selection_aggregator.ts
@@ -16,16 +16,27 @@
import {AreaSelection} from '../../public/selection';
import {Engine} from '../../trace_processor/engine';
import {AreaSelectionAggregator} from '../../public/selection';
-import {SLICE_TRACK_KIND} from '../../public/track_kinds';
+import {UnionDataset} from '../../trace_processor/dataset';
+import {LONG, NUM, STR} from '../../trace_processor/query_result';
export class SliceSelectionAggregator implements AreaSelectionAggregator {
readonly id = 'slice_aggregation';
async createAggregateView(engine: Engine, area: AreaSelection) {
- const selectedTrackKeys = getSelectedTrackSqlIds(area);
-
- if (selectedTrackKeys.length === 0) return false;
-
+ const desiredSchema = {
+ id: NUM,
+ name: STR,
+ ts: LONG,
+ dur: LONG,
+ };
+ const validDatasets = area.tracks
+ .map((track) => track.track.getDataset?.())
+ .filter((ds) => ds !== undefined)
+ .filter((ds) => ds.implements(desiredSchema));
+ if (validDatasets.length === 0) {
+ return false;
+ }
+ const unionDataset = new UnionDataset(validDatasets);
await engine.query(`
create or replace perfetto table ${this.id} as
select
@@ -33,12 +44,13 @@
sum(dur) AS total_dur,
sum(dur)/count() as avg_dur,
count() as occurrences
- from slices
- where track_id in (${selectedTrackKeys})
- and ts + dur > ${area.start}
+ from (${unionDataset.optimize().query()})
+ where
+ ts + dur > ${area.start}
and ts < ${area.end}
group by name
`);
+
return true;
}
@@ -83,14 +95,3 @@
];
}
}
-
-function getSelectedTrackSqlIds(area: AreaSelection): number[] {
- const selectedTrackKeys: number[] = [];
- for (const trackInfo of area.tracks) {
- if (trackInfo?.tags?.kind === SLICE_TRACK_KIND) {
- trackInfo.tags.trackIds &&
- selectedTrackKeys.push(...trackInfo.tags.trackIds);
- }
- }
- return selectedTrackKeys;
-}
diff --git a/ui/src/plugins/dev.perfetto.Frames/actual_frames_track.ts b/ui/src/plugins/dev.perfetto.Frames/actual_frames_track.ts
index d75dd77..2c19110 100644
--- a/ui/src/plugins/dev.perfetto.Frames/actual_frames_track.ts
+++ b/ui/src/plugins/dev.perfetto.Frames/actual_frames_track.ts
@@ -102,6 +102,15 @@
tableName: 'slice',
};
}
+
+ // Override dataset from base class NamedSliceTrack as we don't want these
+ // tracks to participate in generic area selection aggregation (frames tracks
+ // have their own dedicated aggregation panel).
+ // TODO(stevegolton): In future CLs this will be handled with aggregation keys
+ // instead, as this track will have to expose a dataset anyway.
+ override getDataset() {
+ return undefined;
+ }
}
function getColorSchemeForJank(
diff --git a/ui/src/plugins/dev.perfetto.Ftrace/ftrace_track.ts b/ui/src/plugins/dev.perfetto.Ftrace/ftrace_track.ts
index 31ea7de..4ef7793 100644
--- a/ui/src/plugins/dev.perfetto.Ftrace/ftrace_track.ts
+++ b/ui/src/plugins/dev.perfetto.Ftrace/ftrace_track.ts
@@ -20,18 +20,22 @@
import {TrackData} from '../../common/track_data';
import {Engine} from '../../trace_processor/engine';
import {Track} from '../../public/track';
-import {LONG, STR} from '../../trace_processor/query_result';
+import {LONG, NUM, STR} from '../../trace_processor/query_result';
import {FtraceFilter} from './common';
import {Monitor} from '../../base/monitor';
import {TrackRenderContext} from '../../public/track';
+import {SourceDataset, Dataset} from '../../trace_processor/dataset';
const MARGIN = 2;
const RECT_HEIGHT = 18;
+const RECT_WIDTH = 8;
const TRACK_HEIGHT = RECT_HEIGHT + 2 * MARGIN;
-export interface Data extends TrackData {
- timestamps: BigInt64Array;
- names: string[];
+interface Data extends TrackData {
+ events: Array<{
+ timestamp: time;
+ color: string;
+ }>;
}
export interface Config {
@@ -53,6 +57,25 @@
this.monitor = new Monitor([() => store.state]);
}
+ getDataset(): Dataset {
+ return new SourceDataset({
+ // 'ftrace_event' doesn't have a dur column, but injecting dur=0 (all
+ // ftrace events are effectively 'instant') allows us to participate in
+ // generic slice aggregations
+ src: 'select id, ts, 0 as dur, name from ftrace_event',
+ schema: {
+ id: NUM,
+ name: STR,
+ ts: LONG,
+ dur: LONG,
+ },
+ filter: {
+ col: 'cpu',
+ eq: this.cpu,
+ },
+ });
+ }
+
async onUpdate({
visibleWindow,
resolution,
@@ -92,21 +115,22 @@
order by tsQuant limit ${LIMIT};`);
const rowCount = queryRes.numRows();
- const result: Data = {
+
+ const it = queryRes.iter({tsQuant: LONG, name: STR});
+ const events = [];
+ for (let row = 0; it.valid(); it.next(), row++) {
+ events.push({
+ timestamp: Time.fromRaw(it.tsQuant),
+ color: colorForFtrace(it.name).base.cssString,
+ });
+ }
+ return {
start,
end,
resolution,
length: rowCount,
- timestamps: new BigInt64Array(rowCount),
- names: [],
+ events,
};
-
- const it = queryRes.iter({tsQuant: LONG, name: STR});
- for (let row = 0; it.valid(); it.next(), row++) {
- result.timestamps[row] = it.tsQuant;
- result.names[row] = it.name;
- }
- return result;
}
render({ctx, size, timescale}: TrackRenderContext): void {
@@ -125,21 +149,10 @@
dataStartPx,
dataEndPx,
);
-
- const diamondSideLen = RECT_HEIGHT / Math.sqrt(2);
-
- for (let i = 0; i < data.timestamps.length; i++) {
- const name = data.names[i];
- ctx.fillStyle = colorForFtrace(name).base.cssString;
- const timestamp = Time.fromRaw(data.timestamps[i]);
- const xPos = Math.floor(timescale.timeToPx(timestamp));
-
- // Draw a diamond over the event
- ctx.save();
- ctx.translate(xPos, MARGIN);
- ctx.rotate(Math.PI / 4);
- ctx.fillRect(0, 0, diamondSideLen, diamondSideLen);
- ctx.restore();
+ for (const e of data.events) {
+ ctx.fillStyle = e.color;
+ const xPos = Math.floor(timescale.timeToPx(e.timestamp));
+ ctx.fillRect(xPos - RECT_WIDTH / 2, MARGIN, RECT_WIDTH, RECT_HEIGHT);
}
}
}
diff --git a/ui/src/plugins/dev.perfetto.TimelineSync/index.ts b/ui/src/plugins/dev.perfetto.TimelineSync/index.ts
index aef7a76..37206a3 100644
--- a/ui/src/plugins/dev.perfetto.TimelineSync/index.ts
+++ b/ui/src/plugins/dev.perfetto.TimelineSync/index.ts
@@ -272,6 +272,7 @@
private onmessage(msg: MessageEvent) {
if (this._ctx === undefined) return; // Trace unloaded
if (!('perfettoSync' in msg.data)) return;
+ this._ctx.scheduleFullRedraw('force');
const msgData = msg.data as SyncMessage;
const sync = msgData.perfettoSync;
switch (sync.cmd) {
diff --git a/ui/src/plugins/dev.perfetto.WidgetsPage/widgets_page.ts b/ui/src/plugins/dev.perfetto.WidgetsPage/widgets_page.ts
index 327a179..a5ff6d7 100644
--- a/ui/src/plugins/dev.perfetto.WidgetsPage/widgets_page.ts
+++ b/ui/src/plugins/dev.perfetto.WidgetsPage/widgets_page.ts
@@ -685,6 +685,7 @@
icon: arg(icon, 'send'),
rightIcon: arg(rightIcon, 'arrow_forward'),
label: arg(label, 'Button', ''),
+ onclick: () => alert('button pressed'),
...rest,
}),
initialOpts: {
diff --git a/ui/src/public/app.ts b/ui/src/public/app.ts
index 50def57..0c8321b 100644
--- a/ui/src/public/app.ts
+++ b/ui/src/public/app.ts
@@ -54,7 +54,7 @@
// TODO(primiano): this should be needed in extremely rare cases. We should
// probably switch to mithril auto-redraw at some point.
- scheduleFullRedraw(): void;
+ scheduleFullRedraw(force?: 'force'): void;
/**
* Navigate to a new page.
diff --git a/ui/src/public/track.ts b/ui/src/public/track.ts
index 94ac9e7..6d1b1dc 100644
--- a/ui/src/public/track.ts
+++ b/ui/src/public/track.ts
@@ -20,6 +20,7 @@
import {ColorScheme} from './color_scheme';
import {TrackEventDetailsPanel} from './details_panel';
import {TrackEventDetails, TrackEventSelection} from './selection';
+import {Dataset} from '../trace_processor/dataset';
export interface TrackManager {
/**
@@ -175,6 +176,12 @@
onMouseOut?(): void;
/**
+ * Optional: Returns a dataset that represents the events displayed on this
+ * track.
+ */
+ getDataset?(): Dataset | undefined;
+
+ /**
* Optional: Get details of a track event given by eventId on this track.
*/
getSelectionDetails?(eventId: number): Promise<TrackEventDetails | undefined>;
diff --git a/ui/src/trace_processor/dataset.ts b/ui/src/trace_processor/dataset.ts
new file mode 100644
index 0000000..25c64cb
--- /dev/null
+++ b/ui/src/trace_processor/dataset.ts
@@ -0,0 +1,290 @@
+// Copyright (C) 2024 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import {assertUnreachable} from '../base/logging';
+import {getOrCreate} from '../base/utils';
+import {ColumnType, SqlValue} from './query_result';
+
+/**
+ * A dataset defines a set of rows in TraceProcessor and a schema of the
+ * resultant columns. Dataset implementations describe how to get the data in
+ * different ways - e.g. 'source' datasets define a dataset as a table name (or
+ * select statement) + filters, whereas a 'union' dataset defines a dataset as
+ * the union of other datasets.
+ *
+ * The idea is that users can build arbitrarily complex trees of datasets, then
+ * at any point call `optimize()` to create the smallest possible tree that
+ * represents the same dataset, and `query()` which produces a select statement
+ * for the resultant dataset.
+ *
+ * Users can also use the `schema` property and `implements()` to get and test
+ * the schema of a given dataset.
+ */
+export interface Dataset {
+ /**
+ * Get or calculate the resultant schema of this dataset.
+ */
+ readonly schema: DatasetSchema;
+
+ /**
+ * Produce a query for this dataset.
+ *
+ * @param schema - The schema to use for extracting columns - if undefined,
+ * the most specific possible schema is evaluated from the dataset first and
+ * used instead.
+ */
+ query(schema?: DatasetSchema): string;
+
+ /**
+ * Optimizes a dataset into the smallest possible expression.
+ *
+ * For example by combining elements of union data sets that have the same src
+ * and similar filters into a single set.
+ *
+ * For example, the following 'union' dataset...
+ *
+ * ```
+ * {
+ * union: [
+ * {
+ * src: 'foo',
+ * schema: {
+ * 'a': NUM,
+ * 'b': NUM,
+ * },
+ * filter: {col: 'a', eq: 1},
+ * },
+ * {
+ * src: 'foo',
+ * schema: {
+ * 'a': NUM,
+ * 'b': NUM,
+ * },
+ * filter: {col: 'a', eq: 2},
+ * },
+ * ]
+ * }
+ * ```
+ *
+ * ...will be combined into a single 'source' dataset...
+ *
+ * ```
+ * {
+ * src: 'foo',
+ * schema: {
+ * 'a': NUM,
+ * 'b': NUM,
+ * },
+ * filter: {col: 'a', in: [1, 2]},
+ * },
+ * ```
+ */
+ optimize(): Dataset;
+
+ /**
+ * Returns true if this dataset implements a given schema.
+ *
+ * @param schema - The schema to test against.
+ */
+ implements(schema: DatasetSchema): boolean;
+}
+
+/**
+ * Defines a list of columns and types that define the shape of the data
+ * represented by a dataset.
+ */
+export type DatasetSchema = Record<string, ColumnType>;
+
+/**
+ * A filter used to express that a column must equal a value.
+ */
+interface EqFilter {
+ readonly col: string;
+ readonly eq: SqlValue;
+}
+
+/**
+ * A filter used to express that column must be one of a set of values.
+ */
+interface InFilter {
+ readonly col: string;
+ readonly in: ReadonlyArray<SqlValue>;
+}
+
+/**
+ * Union of all filter types.
+ */
+type Filter = EqFilter | InFilter;
+
+/**
+ * Named arguments for a SourceDataset.
+ */
+interface SourceDatasetConfig {
+ readonly src: string;
+ readonly schema: DatasetSchema;
+ readonly filter?: Filter;
+}
+
+/**
+ * Defines a dataset with a source SQL select statement of table name, a
+ * schema describing the columns, and an optional filter.
+ */
+export class SourceDataset implements Dataset {
+ readonly src: string;
+ readonly schema: DatasetSchema;
+ readonly filter?: Filter;
+
+ constructor(config: SourceDatasetConfig) {
+ this.src = config.src;
+ this.schema = config.schema;
+ this.filter = config.filter;
+ }
+
+ query(schema?: DatasetSchema) {
+ schema = schema ?? this.schema;
+ const cols = Object.keys(schema);
+ const whereClause = this.filterToQuery();
+ return `select ${cols.join(', ')} from (${this.src}) ${whereClause}`.trim();
+ }
+
+ optimize() {
+ // Cannot optimize SourceDataset
+ return this;
+ }
+
+ implements(schema: DatasetSchema) {
+ return Object.entries(schema).every(([name, kind]) => {
+ return name in this.schema && this.schema[name] === kind;
+ });
+ }
+
+ private filterToQuery() {
+ const filter = this.filter;
+ if (filter === undefined) {
+ return '';
+ }
+ if ('eq' in filter) {
+ return `where ${filter.col} = ${filter.eq}`;
+ } else if ('in' in filter) {
+ return `where ${filter.col} in (${filter.in.join(',')})`;
+ } else {
+ assertUnreachable(filter);
+ }
+ }
+}
+
+/**
+ * A dataset that represents the union of multiple datasets.
+ */
+export class UnionDataset implements Dataset {
+ constructor(readonly union: ReadonlyArray<Dataset>) {}
+
+ get schema(): DatasetSchema {
+ // Find the minimal set of columns that are supported by all datasets of
+ // the union
+ let sch: Record<string, ColumnType> | undefined = undefined;
+ this.union.forEach((ds) => {
+ const dsSchema = ds.schema;
+ if (sch === undefined) {
+ // First time just use this one
+ sch = dsSchema;
+ } else {
+ const newSch: Record<string, ColumnType> = {};
+ for (const [key, kind] of Object.entries(sch)) {
+ if (key in dsSchema && dsSchema[key] === kind) {
+ newSch[key] = kind;
+ }
+ }
+ sch = newSch;
+ }
+ });
+ return sch ?? {};
+ }
+
+ query(schema?: DatasetSchema): string {
+ schema = schema ?? this.schema;
+ return this.union
+ .map((dataset) => dataset.query(schema))
+ .join(' union all ');
+ }
+
+ optimize(): Dataset {
+ // Recursively optimize each dataset of this union
+ const optimizedUnion = this.union.map((ds) => ds.optimize());
+
+ // Find all source datasets and combine then based on src
+ const combinedSrcSets = new Map<string, SourceDataset[]>();
+ const otherDatasets: Dataset[] = [];
+ for (const e of optimizedUnion) {
+ if (e instanceof SourceDataset) {
+ const set = getOrCreate(combinedSrcSets, e.src, () => []);
+ set.push(e);
+ } else {
+ otherDatasets.push(e);
+ }
+ }
+
+ const mergedSrcSets = Array.from(combinedSrcSets.values()).map(
+ (srcGroup) => {
+ if (srcGroup.length === 1) return srcGroup[0];
+
+ // Combine schema across all members in the union
+ const combinedSchema = srcGroup.reduce((acc, e) => {
+ Object.assign(acc, e.schema);
+ return acc;
+ }, {} as DatasetSchema);
+
+ // Merge filters for the same src
+ const inFilters: InFilter[] = [];
+ for (const {filter} of srcGroup) {
+ if (filter) {
+ if ('eq' in filter) {
+ inFilters.push({col: filter.col, in: [filter.eq]});
+ } else {
+ inFilters.push(filter);
+ }
+ }
+ }
+
+ const mergedFilter = mergeFilters(inFilters);
+ return new SourceDataset({
+ src: srcGroup[0].src,
+ schema: combinedSchema,
+ filter: mergedFilter,
+ });
+ },
+ );
+
+ const finalUnion = [...mergedSrcSets, ...otherDatasets];
+
+ if (finalUnion.length === 1) {
+ return finalUnion[0];
+ } else {
+ return new UnionDataset(finalUnion);
+ }
+ }
+
+ implements(schema: DatasetSchema) {
+ return Object.entries(schema).every(([name, kind]) => {
+ return name in this.schema && this.schema[name] === kind;
+ });
+ }
+}
+
+function mergeFilters(filters: InFilter[]): InFilter | undefined {
+ if (filters.length === 0) return undefined;
+ const col = filters[0].col;
+ const values = new Set(filters.flatMap((filter) => filter.in));
+ return {col, in: Array.from(values)};
+}
diff --git a/ui/src/trace_processor/dataset_unittest.ts b/ui/src/trace_processor/dataset_unittest.ts
new file mode 100644
index 0000000..2bd4e53
--- /dev/null
+++ b/ui/src/trace_processor/dataset_unittest.ts
@@ -0,0 +1,228 @@
+// Copyright (C) 2024 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import {SourceDataset, UnionDataset} from './dataset';
+import {LONG, NUM, STR} from './query_result';
+
+test('get query for simple dataset', () => {
+ const dataset = new SourceDataset({
+ src: 'slice',
+ schema: {id: NUM},
+ });
+
+ expect(dataset.query()).toEqual('select id from (slice)');
+});
+
+test("get query for simple dataset with 'eq' filter", () => {
+ const dataset = new SourceDataset({
+ src: 'slice',
+ schema: {id: NUM},
+ filter: {
+ col: 'id',
+ eq: 123,
+ },
+ });
+
+ expect(dataset.query()).toEqual('select id from (slice) where id = 123');
+});
+
+test("get query for simple dataset with an 'in' filter", () => {
+ const dataset = new SourceDataset({
+ src: 'slice',
+ schema: {id: NUM},
+ filter: {
+ col: 'id',
+ in: [123, 456],
+ },
+ });
+
+ expect(dataset.query()).toEqual(
+ 'select id from (slice) where id in (123,456)',
+ );
+});
+
+test('get query for union dataset', () => {
+ const dataset = new UnionDataset([
+ new SourceDataset({
+ src: 'slice',
+ schema: {id: NUM},
+ filter: {
+ col: 'id',
+ eq: 123,
+ },
+ }),
+ new SourceDataset({
+ src: 'slice',
+ schema: {id: NUM},
+ filter: {
+ col: 'id',
+ eq: 456,
+ },
+ }),
+ ]);
+
+ expect(dataset.query()).toEqual(
+ 'select id from (slice) where id = 123 union all select id from (slice) where id = 456',
+ );
+});
+
+test('doesImplement', () => {
+ const dataset = new SourceDataset({
+ src: 'slice',
+ schema: {id: NUM, ts: LONG},
+ });
+
+ expect(dataset.implements({id: NUM})).toBe(true);
+ expect(dataset.implements({id: NUM, ts: LONG})).toBe(true);
+ expect(dataset.implements({id: NUM, ts: LONG, name: STR})).toBe(false);
+ expect(dataset.implements({id: LONG})).toBe(false);
+});
+
+test('find the schema of a simple dataset', () => {
+ const dataset = new SourceDataset({
+ src: 'slice',
+ schema: {id: NUM, ts: LONG},
+ });
+
+ expect(dataset.schema).toMatchObject({id: NUM, ts: LONG});
+});
+
+test('find the schema of a union where source sets differ in their names', () => {
+ const dataset = new UnionDataset([
+ new SourceDataset({
+ src: 'slice',
+ schema: {foo: NUM},
+ }),
+ new SourceDataset({
+ src: 'slice',
+ schema: {bar: NUM},
+ }),
+ ]);
+
+ expect(dataset.schema).toMatchObject({});
+});
+
+test('find the schema of a union with differing source sets', () => {
+ const dataset = new UnionDataset([
+ new SourceDataset({
+ src: 'slice',
+ schema: {foo: NUM},
+ }),
+ new SourceDataset({
+ src: 'slice',
+ schema: {foo: LONG},
+ }),
+ ]);
+
+ expect(dataset.schema).toMatchObject({});
+});
+
+test('find the schema of a union with one column in common', () => {
+ const dataset = new UnionDataset([
+ new SourceDataset({
+ src: 'slice',
+ schema: {foo: NUM, bar: NUM},
+ }),
+ new SourceDataset({
+ src: 'slice',
+ schema: {foo: NUM, baz: NUM},
+ }),
+ ]);
+
+ expect(dataset.schema).toMatchObject({foo: NUM});
+});
+
+test('optimize a union dataset', () => {
+ const dataset = new UnionDataset([
+ new SourceDataset({
+ src: 'slice',
+ schema: {},
+ filter: {
+ col: 'track_id',
+ eq: 123,
+ },
+ }),
+ new SourceDataset({
+ src: 'slice',
+ schema: {},
+ filter: {
+ col: 'track_id',
+ eq: 456,
+ },
+ }),
+ ]);
+
+ expect(dataset.optimize()).toEqual({
+ src: 'slice',
+ schema: {},
+ filter: {
+ col: 'track_id',
+ in: [123, 456],
+ },
+ });
+});
+
+test('optimize a union dataset with different types of filters', () => {
+ const dataset = new UnionDataset([
+ new SourceDataset({
+ src: 'slice',
+ schema: {},
+ filter: {
+ col: 'track_id',
+ eq: 123,
+ },
+ }),
+ new SourceDataset({
+ src: 'slice',
+ schema: {},
+ filter: {
+ col: 'track_id',
+ in: [456, 789],
+ },
+ }),
+ ]);
+
+ expect(dataset.optimize()).toEqual({
+ src: 'slice',
+ schema: {},
+ filter: {
+ col: 'track_id',
+ in: [123, 456, 789],
+ },
+ });
+});
+
+test('optimize a union dataset with different schemas', () => {
+ const dataset = new UnionDataset([
+ new SourceDataset({
+ src: 'slice',
+ schema: {foo: NUM},
+ }),
+ new SourceDataset({
+ src: 'slice',
+ schema: {bar: NUM},
+ }),
+ ]);
+
+ expect(dataset.optimize()).toEqual({
+ src: 'slice',
+ // The resultant schema is the combination of the union's member's schemas,
+ // as we know the source is the same as we know we can get all of the 'seen'
+ // columns from the source.
+ schema: {
+ foo: NUM,
+ bar: NUM,
+ },
+ });
+});
diff --git a/ui/src/trace_processor/engine.ts b/ui/src/trace_processor/engine.ts
index ccb8a03..58a3705 100644
--- a/ui/src/trace_processor/engine.ts
+++ b/ui/src/trace_processor/engine.ts
@@ -208,7 +208,7 @@
let isFinalResponse = true;
switch (rpc.response) {
- case TPM.TPM_APPEND_TRACE_DATA:
+ case TPM.TPM_APPEND_TRACE_DATA: {
const appendResult = assertExists(rpc.appendResult);
const pendingPromise = assertExists(this.pendingParses.shift());
if (exists(appendResult.error) && appendResult.error.length > 0) {
@@ -217,9 +217,17 @@
pendingPromise.resolve();
}
break;
- case TPM.TPM_FINALIZE_TRACE_DATA:
- assertExists(this.pendingEOFs.shift()).resolve();
+ }
+ case TPM.TPM_FINALIZE_TRACE_DATA: {
+ const finalizeResult = assertExists(rpc.finalizeDataResult);
+ const pendingPromise = assertExists(this.pendingEOFs.shift());
+ if (exists(finalizeResult.error) && finalizeResult.error.length > 0) {
+ pendingPromise.reject(finalizeResult.error);
+ } else {
+ pendingPromise.resolve();
+ }
break;
+ }
case TPM.TPM_RESET_TRACE_PROCESSOR:
assertExists(this.pendingResetTraceProcessors.shift()).resolve();
break;
diff --git a/ui/src/widgets/editor.ts b/ui/src/widgets/editor.ts
index 58ea153..1187be0 100644
--- a/ui/src/widgets/editor.ts
+++ b/ui/src/widgets/editor.ts
@@ -21,6 +21,7 @@
import {assertExists} from '../base/logging';
import {DragGestureHandler} from '../base/drag_gesture_handler';
import {DisposableStack} from '../base/disposable_stack';
+import {scheduleFullRedraw} from './raf';
export interface EditorAttrs {
// Initial state for the editor.
@@ -64,6 +65,7 @@
text = selectedText;
}
onExecute(text);
+ scheduleFullRedraw('force');
return true;
},
});
@@ -75,6 +77,7 @@
view.update([tr]);
const text = view.state.doc.toString();
onUpdate(text);
+ scheduleFullRedraw('force');
};
}
diff --git a/ui/src/widgets/hotkey_context.ts b/ui/src/widgets/hotkey_context.ts
index f4d702a..767683e 100644
--- a/ui/src/widgets/hotkey_context.ts
+++ b/ui/src/widgets/hotkey_context.ts
@@ -14,6 +14,7 @@
import m from 'mithril';
import {checkHotkey, Hotkey} from '../base/hotkeys';
+import {scheduleFullRedraw} from './raf';
export interface HotkeyConfig {
hotkey: Hotkey;
@@ -58,6 +59,7 @@
if (checkHotkey(hotkey, e)) {
e.preventDefault();
callback();
+ scheduleFullRedraw('force');
}
});
}
diff --git a/ui/src/widgets/modal.ts b/ui/src/widgets/modal.ts
index e32f329..c07e6fe 100644
--- a/ui/src/widgets/modal.ts
+++ b/ui/src/widgets/modal.ts
@@ -14,8 +14,8 @@
import m from 'mithril';
import {defer} from '../base/deferred';
-import {scheduleFullRedraw} from './raf';
import {Icon} from './icon';
+import {scheduleFullRedraw} from './raf';
// This module deals with modal dialogs. Unlike most components, here we want to
// render the DOM elements outside of the corresponding vdom tree. For instance
@@ -79,7 +79,10 @@
export class Modal implements m.ClassComponent<ModalAttrs> {
onbeforeremove(vnode: m.VnodeDOM<ModalAttrs>) {
const removePromise = defer<void>();
- vnode.dom.addEventListener('animationend', () => removePromise.resolve());
+ vnode.dom.addEventListener('animationend', () => {
+ scheduleFullRedraw('force');
+ removePromise.resolve();
+ });
vnode.dom.classList.add('modal-fadeout');
// Retuning `removePromise` will cause Mithril to defer the actual component
@@ -94,7 +97,6 @@
// in turn will: (1) call the user's original attrs.onClose; (2) resolve
// the promise returned by showModal().
vnode.attrs.onClose();
- scheduleFullRedraw();
}
}
@@ -223,7 +225,7 @@
},
};
currentModal = attrs;
- scheduleFullRedraw();
+ redrawModal();
return returnedClosePromise;
}
@@ -232,7 +234,7 @@
// evident why a redraw is requested.
export function redrawModal() {
if (currentModal !== undefined) {
- scheduleFullRedraw();
+ scheduleFullRedraw('force');
}
}
@@ -251,7 +253,7 @@
return;
}
currentModal = undefined;
- scheduleFullRedraw();
+ scheduleFullRedraw('force');
}
export function getCurrentModalKey(): string | undefined {
diff --git a/ui/src/widgets/popup.ts b/ui/src/widgets/popup.ts
index ed16695..ac8b563 100644
--- a/ui/src/widgets/popup.ts
+++ b/ui/src/widgets/popup.ts
@@ -352,13 +352,13 @@
if (this.isOpen) {
this.isOpen = false;
this.onChange(this.isOpen);
- scheduleFullRedraw();
+ scheduleFullRedraw('force');
}
}
private togglePopup() {
this.isOpen = !this.isOpen;
this.onChange(this.isOpen);
- scheduleFullRedraw();
+ scheduleFullRedraw('force');
}
}
diff --git a/ui/src/widgets/portal.ts b/ui/src/widgets/portal.ts
index 734fee6..91c3608 100644
--- a/ui/src/widgets/portal.ts
+++ b/ui/src/widgets/portal.ts
@@ -46,13 +46,22 @@
export class Portal implements m.ClassComponent<PortalAttrs> {
private portalElement?: HTMLElement;
private containerElement?: Element;
+ private contentComponent: m.Component;
+
+ constructor({children}: m.CVnode<PortalAttrs>) {
+ // Create a temporary component that we can mount in oncreate, and unmount
+ // in onremove, but inject the new portal content (children) into it each
+ // render cycle. This is initialized here rather than in oncreate to avoid
+ // having to make it optional or use assertExists().
+ this.contentComponent = {view: () => children};
+ }
view() {
// Dummy element renders nothing but permits DOM access in lifecycle hooks.
return m('span', {style: {display: 'none'}});
}
- oncreate({attrs, children, dom}: m.VnodeDOM<PortalAttrs, this>) {
+ oncreate({attrs, dom}: m.CVnodeDOM<PortalAttrs>) {
const {
onContentMount = () => {},
onBeforeContentMount = (): MountOptions => ({}),
@@ -65,16 +74,21 @@
container.appendChild(this.portalElement);
this.applyPortalProps(attrs);
- m.render(this.portalElement, children);
+ m.mount(this.portalElement, this.contentComponent);
onContentMount(this.portalElement);
}
- onupdate({attrs, children}: m.VnodeDOM<PortalAttrs, this>) {
+ onbeforeupdate({children}: m.CVnode<PortalAttrs>) {
+ // Update the mounted content's view function to return the latest portal
+ // content passed in via children, without changing the component itself.
+ this.contentComponent.view = () => children;
+ }
+
+ onupdate({attrs}: m.CVnodeDOM<PortalAttrs>) {
const {onContentUpdate = () => {}} = attrs;
if (this.portalElement) {
this.applyPortalProps(attrs);
- m.render(this.portalElement, children);
onContentUpdate(this.portalElement);
}
}
@@ -86,14 +100,14 @@
}
}
- onremove({attrs}: m.VnodeDOM<PortalAttrs, this>) {
+ onremove({attrs}: m.CVnodeDOM<PortalAttrs>) {
const {onContentUnmount = () => {}} = attrs;
const container = this.containerElement ?? document.body;
if (this.portalElement) {
if (container.contains(this.portalElement)) {
onContentUnmount(this.portalElement);
// Rendering null ensures previous vnodes are removed properly.
- m.render(this.portalElement, null);
+ m.mount(this.portalElement, null);
container.removeChild(this.portalElement);
}
}
diff --git a/ui/src/widgets/raf.ts b/ui/src/widgets/raf.ts
index 20afb61..dc0d3ab 100644
--- a/ui/src/widgets/raf.ts
+++ b/ui/src/widgets/raf.ts
@@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-let FULL_REDRAW_FUNCTION = () => {};
+let FULL_REDRAW_FUNCTION = (_force?: 'force') => {};
export function setScheduleFullRedraw(func: () => void) {
FULL_REDRAW_FUNCTION = func;
}
-export function scheduleFullRedraw() {
- FULL_REDRAW_FUNCTION();
+export function scheduleFullRedraw(force?: 'force') {
+ FULL_REDRAW_FUNCTION(force);
}
diff --git a/ui/src/widgets/vega_view.ts b/ui/src/widgets/vega_view.ts
index 7cbf533..1a8cb43 100644
--- a/ui/src/widgets/vega_view.ts
+++ b/ui/src/widgets/vega_view.ts
@@ -228,7 +228,7 @@
}
this._status = Status.Done;
this.pending = undefined;
- scheduleFullRedraw();
+ scheduleFullRedraw('force');
}
private handleError(pending: Promise<vega.View>, err: unknown) {
@@ -242,7 +242,7 @@
private setError(err: unknown) {
this._status = Status.Error;
this._error = getErrorMessage(err);
- scheduleFullRedraw();
+ scheduleFullRedraw('force');
}
[Symbol.dispose]() {
diff --git a/ui/src/widgets/virtual_scroll_helper.ts b/ui/src/widgets/virtual_scroll_helper.ts
index 475c360..6172c94 100644
--- a/ui/src/widgets/virtual_scroll_helper.ts
+++ b/ui/src/widgets/virtual_scroll_helper.ts
@@ -14,6 +14,7 @@
import {DisposableStack} from '../base/disposable_stack';
import {Bounds2D, Rect2D} from '../base/geom';
+import {scheduleFullRedraw} from './raf';
export interface VirtualScrollHelperOpts {
overdrawPx: number;
@@ -46,6 +47,7 @@
this._data.forEach((data) =>
recalculatePuckRect(sliderElement, containerElement, data),
);
+ scheduleFullRedraw('force');
};
containerElement.addEventListener('scroll', recalculateRects, {