From e9ccb723e09a13114c70d6884a5aeffed99b64da Mon Sep 17 00:00:00 2001 From: Lalit Maganti Date: Mon, 14 Oct 2024 17:10:36 +0100 Subject: [PATCH] ui: tp: remove legacy derived events from trace processor This CL deletes all remaining derived events from trace processor and the UI as well as all supporting code. Most of the important events were already migrated to plugins, remaining events have not been touched in years so likely are not meaningful anymore and it's not worth us supporting them further. Change-Id: Iccced0c0789422403e24017410ad71ddf08496af --- Android.bp | 10 - BUILD | 4 - docs/analysis/trace-processor.md | 30 --- docs/contributing/common-tasks.md | 41 ---- docs/contributing/embedding.md | 7 - protos/perfetto/metrics/android/BUILD.gn | 2 - .../android/android_trusty_workqueues.proto | 22 -- .../metrics/android/other_traces.proto | 25 --- protos/perfetto/metrics/metrics.proto | 12 +- .../metrics/perfetto_merged_metrics.proto | 27 +-- .../trace_processor/metrics.descriptor | 19 +- .../metrics/sql/android/BUILD.gn | 2 - .../metrics/sql/android/android_camera.sql | 9 - .../metrics/sql/android/android_fastrpc.sql | 14 -- .../metrics/sql/android/android_ion.sql | 14 -- .../metrics/sql/android/android_lmk.sql | 40 ---- .../sql/android/android_other_traces.sql | 47 ---- .../sql/android/android_surfaceflinger.sql | 11 - .../sql/android/android_trusty_workqueues.sql | 21 -- .../experimental/chrome_dropped_frames.sql | 30 --- .../sql/experimental/chrome_long_latency.sql | 30 --- .../all-tracks-expanded.png.sha256 | 2 +- .../trace-loaded/trace-loaded.png.sha256 | 2 +- .../load-trace/loaded.png.sha256 | 2 +- .../slice-with-flows.png.sha256 | 2 +- .../diff_tests/metrics/graphics/tests.py | 17 -- .../parser/parsing/otheruuids.textproto | 46 ---- .../diff_tests/parser/parsing/tests.py | 12 -- ui/src/core/load_trace.ts | 204 +----------------- ui/src/core_plugins/annotation/index.ts | 156 -------------- ui/src/core_plugins/async_slices/index.ts | 8 +- ui/src/core_plugins/frames/index.ts | 4 +- ui/src/frontend/thread_slice_details_tab.ts | 60 +----- 33 files changed, 33 insertions(+), 899 deletions(-) delete mode 100644 protos/perfetto/metrics/android/android_trusty_workqueues.proto delete mode 100644 protos/perfetto/metrics/android/other_traces.proto delete mode 100644 src/trace_processor/metrics/sql/android/android_other_traces.sql delete mode 100644 src/trace_processor/metrics/sql/android/android_trusty_workqueues.sql delete mode 100644 test/trace_processor/diff_tests/parser/parsing/otheruuids.textproto delete mode 100644 ui/src/core_plugins/annotation/index.ts diff --git a/Android.bp b/Android.bp index e1553aff20..397ea64867 100644 --- a/Android.bp +++ b/Android.bp @@ -2783,7 +2783,6 @@ python_library_host { "protos/perfetto/metrics/android/android_garbage_collection_unagg_metric.proto", "protos/perfetto/metrics/android/android_oom_adjuster_metric.proto", "protos/perfetto/metrics/android/android_sysui_notifications_blocking_calls_metric.proto", - "protos/perfetto/metrics/android/android_trusty_workqueues.proto", "protos/perfetto/metrics/android/anr_metric.proto", "protos/perfetto/metrics/android/app_process_starts_metric.proto", "protos/perfetto/metrics/android/auto_metric.proto", @@ -2817,7 +2816,6 @@ python_library_host { "protos/perfetto/metrics/android/monitor_contention_metric.proto", "protos/perfetto/metrics/android/multiuser_metric.proto", "protos/perfetto/metrics/android/network_metric.proto", - "protos/perfetto/metrics/android/other_traces.proto", "protos/perfetto/metrics/android/package_list.proto", "protos/perfetto/metrics/android/powrails_metric.proto", "protos/perfetto/metrics/android/process_metadata.proto", @@ -5419,7 +5417,6 @@ genrule { "protos/perfetto/metrics/android/android_garbage_collection_unagg_metric.proto", "protos/perfetto/metrics/android/android_oom_adjuster_metric.proto", "protos/perfetto/metrics/android/android_sysui_notifications_blocking_calls_metric.proto", - "protos/perfetto/metrics/android/android_trusty_workqueues.proto", "protos/perfetto/metrics/android/anr_metric.proto", "protos/perfetto/metrics/android/app_process_starts_metric.proto", "protos/perfetto/metrics/android/auto_metric.proto", @@ -5453,7 +5450,6 @@ genrule { "protos/perfetto/metrics/android/monitor_contention_metric.proto", "protos/perfetto/metrics/android/multiuser_metric.proto", "protos/perfetto/metrics/android/network_metric.proto", - "protos/perfetto/metrics/android/other_traces.proto", "protos/perfetto/metrics/android/package_list.proto", "protos/perfetto/metrics/android/powrails_metric.proto", "protos/perfetto/metrics/android/process_metadata.proto", @@ -5515,7 +5511,6 @@ genrule { "protos/perfetto/metrics/android/android_garbage_collection_unagg_metric.proto", "protos/perfetto/metrics/android/android_oom_adjuster_metric.proto", "protos/perfetto/metrics/android/android_sysui_notifications_blocking_calls_metric.proto", - "protos/perfetto/metrics/android/android_trusty_workqueues.proto", "protos/perfetto/metrics/android/anr_metric.proto", "protos/perfetto/metrics/android/app_process_starts_metric.proto", "protos/perfetto/metrics/android/auto_metric.proto", @@ -5549,7 +5544,6 @@ genrule { "protos/perfetto/metrics/android/monitor_contention_metric.proto", "protos/perfetto/metrics/android/multiuser_metric.proto", "protos/perfetto/metrics/android/network_metric.proto", - "protos/perfetto/metrics/android/other_traces.proto", "protos/perfetto/metrics/android/package_list.proto", "protos/perfetto/metrics/android/powrails_metric.proto", "protos/perfetto/metrics/android/process_metadata.proto", @@ -5595,7 +5589,6 @@ genrule { "protos/perfetto/metrics/android/android_garbage_collection_unagg_metric.proto", "protos/perfetto/metrics/android/android_oom_adjuster_metric.proto", "protos/perfetto/metrics/android/android_sysui_notifications_blocking_calls_metric.proto", - "protos/perfetto/metrics/android/android_trusty_workqueues.proto", "protos/perfetto/metrics/android/anr_metric.proto", "protos/perfetto/metrics/android/app_process_starts_metric.proto", "protos/perfetto/metrics/android/auto_metric.proto", @@ -5629,7 +5622,6 @@ genrule { "protos/perfetto/metrics/android/monitor_contention_metric.proto", "protos/perfetto/metrics/android/multiuser_metric.proto", "protos/perfetto/metrics/android/network_metric.proto", - "protos/perfetto/metrics/android/other_traces.proto", "protos/perfetto/metrics/android/package_list.proto", "protos/perfetto/metrics/android/powrails_metric.proto", "protos/perfetto/metrics/android/process_metadata.proto", @@ -13128,7 +13120,6 @@ genrule { "src/trace_processor/metrics/sql/android/android_multiuser_populator.sql", "src/trace_processor/metrics/sql/android/android_netperf.sql", "src/trace_processor/metrics/sql/android/android_oom_adjuster.sql", - "src/trace_processor/metrics/sql/android/android_other_traces.sql", "src/trace_processor/metrics/sql/android/android_package_list.sql", "src/trace_processor/metrics/sql/android/android_powrails.sql", "src/trace_processor/metrics/sql/android/android_proxy_power.sql", @@ -13139,7 +13130,6 @@ genrule { "src/trace_processor/metrics/sql/android/android_sysui_notifications_blocking_calls_metric.sql", "src/trace_processor/metrics/sql/android/android_task_names.sql", "src/trace_processor/metrics/sql/android/android_trace_quality.sql", - "src/trace_processor/metrics/sql/android/android_trusty_workqueues.sql", "src/trace_processor/metrics/sql/android/codec_metrics.sql", "src/trace_processor/metrics/sql/android/composer_execution.sql", "src/trace_processor/metrics/sql/android/composition_layers.sql", diff --git a/BUILD b/BUILD index 540d2aaf61..9a64603c0c 100644 --- a/BUILD +++ b/BUILD @@ -2267,7 +2267,6 @@ perfetto_filegroup( "src/trace_processor/metrics/sql/android/android_multiuser_populator.sql", "src/trace_processor/metrics/sql/android/android_netperf.sql", "src/trace_processor/metrics/sql/android/android_oom_adjuster.sql", - "src/trace_processor/metrics/sql/android/android_other_traces.sql", "src/trace_processor/metrics/sql/android/android_package_list.sql", "src/trace_processor/metrics/sql/android/android_powrails.sql", "src/trace_processor/metrics/sql/android/android_proxy_power.sql", @@ -2278,7 +2277,6 @@ perfetto_filegroup( "src/trace_processor/metrics/sql/android/android_sysui_notifications_blocking_calls_metric.sql", "src/trace_processor/metrics/sql/android/android_task_names.sql", "src/trace_processor/metrics/sql/android/android_trace_quality.sql", - "src/trace_processor/metrics/sql/android/android_trusty_workqueues.sql", "src/trace_processor/metrics/sql/android/codec_metrics.sql", "src/trace_processor/metrics/sql/android/composer_execution.sql", "src/trace_processor/metrics/sql/android/composition_layers.sql", @@ -4962,7 +4960,6 @@ perfetto_proto_library( "protos/perfetto/metrics/android/android_garbage_collection_unagg_metric.proto", "protos/perfetto/metrics/android/android_oom_adjuster_metric.proto", "protos/perfetto/metrics/android/android_sysui_notifications_blocking_calls_metric.proto", - "protos/perfetto/metrics/android/android_trusty_workqueues.proto", "protos/perfetto/metrics/android/anr_metric.proto", "protos/perfetto/metrics/android/app_process_starts_metric.proto", "protos/perfetto/metrics/android/auto_metric.proto", @@ -4996,7 +4993,6 @@ perfetto_proto_library( "protos/perfetto/metrics/android/monitor_contention_metric.proto", "protos/perfetto/metrics/android/multiuser_metric.proto", "protos/perfetto/metrics/android/network_metric.proto", - "protos/perfetto/metrics/android/other_traces.proto", "protos/perfetto/metrics/android/package_list.proto", "protos/perfetto/metrics/android/powrails_metric.proto", "protos/perfetto/metrics/android/process_metadata.proto", diff --git a/docs/analysis/trace-processor.md b/docs/analysis/trace-processor.md index a45956604a..2de341976d 100644 --- a/docs/analysis/trace-processor.md +++ b/docs/analysis/trace-processor.md @@ -509,36 +509,6 @@ TIP: To see how to add to add a new metric to trace processor, see the checklist The metrics subsystem is a significant part of trace processor and thus is documented on its own [page](/docs/analysis/metrics.md). -## Creating derived events - -TIP: To see how to add to add a new annotation to trace processor, see the - checklist [here](/docs/contributing/common-tasks.md#new-annotation). - -This feature allows creation of new events (slices and counters) from the data -in the trace. These events can then be displayed in the UI tracks as if they -were part of the trace itself. - -This is useful as often the data in the trace is very low-level. While low -level information is important for experts to perform deep debugging, often -users are just looking for a high level overview without needing to consider -events from multiple locations. - -For example, an app startup in Android spans multiple components including -`ActivityManager`, `system_server`, and the newly created app process derived -from `zygote`. Most users do not need this level of detail; they are only -interested in a single slice spanning the entire startup. - -Creating derived events is tied very closely to -[metrics subsystem](/docs/analysis/metrics.md); often SQL-based metrics need to -create higher-level abstractions from raw events as intermediate artifacts. - -From previous example, the -[startup metric](/src/trace_processor/metrics/sql/android/android_startup.sql) -creates the exact `launching` slice we want to display in the UI. - -The other benefit of aligning the two is that changes in metrics are -automatically kept in sync with what the user sees in the UI. - ## Python API The trace processor's C++ library is also exposed through Python. This is documented on a [separate page](/docs/analysis/trace-processor-python.md). diff --git a/docs/contributing/common-tasks.md b/docs/contributing/common-tasks.md index 11d4f140f3..43c5421f24 100644 --- a/docs/contributing/common-tasks.md +++ b/docs/contributing/common-tasks.md @@ -138,47 +138,6 @@ Here is an [example change](https://android-review.googlesource.com/c/platform/e 3. Run the newly added test with `tools/diff_test_trace_processor.py `. 4. Upload and land your change as normal. -## Adding new derived events - -As derived events depend on metrics, the initial steps are same as that of developing a metric (see above). - -NOTE: the metric can be just an empty proto message during prototyping or if no summarization is necessary. However, generally if an event is important enough to display in the UI, it should also be tracked in benchmarks as a metric. - -To extend a metric with annotations: - -1. Create a new table or view with the name `_event`. - * For example, for the [`android_startup`]() metric, we create a view named `android_startup_event`. - * Note that the trailing `_event` suffix in the table name is important. - * The schema required for this table is given below. -2. List your metric in the `initialiseHelperViews` method of `trace_controller.ts`. -3. Upload and land your change as normal. - -The schema of the `_event` table/view is as follows: - -| Name | Type | Presence | Meaning | -| :----------- | -------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `track_type` | `string` | Mandatory | 'slice' for slices, 'counter' for counters | -| `track_name` | `string` | Mandatory | Name of the track to display in the UI. Also the track identifier i.e. all events with same `track_name` appear on the same track. | -| `ts` | `int64` | Mandatory | The timestamp of the event (slice or counter) | -| `dur` | `int64` | Mandatory for slice, NULL for counter | The duration of the slice | -| `slice_name` | `string` | Mandatory for slice, NULL for counter | The name of the slice | -| `value` | `double` | Mandatory for counter, NULL for slice | The value of the counter | -| `group_name` | `string` | Optional | Name of the track group under which the track appears. All tracks with the same `group_name` are placed under the same group by that name. Tracks that lack this field or have NULL value in this field are displayed without any grouping. | - -#### Known issues: - -* Nested slices within the same track are not supported. We plan to support this - once we have a concrete usecase. -* Tracks are always created in the global scope. We plan to extend this to - threads and processes in the near future with additional contexts added as - necessary. -* Instant events are currently not supported in the UI but this will be - implemented in the near future. In trace processor, instants are always `0` - duration slices with special rendering on the UI side. -* There is no way to tie newly added events back to the source events in the - trace which were used to generate them. This is not currently a priority but - something we may add in the future. - ## Update `TRACE_PROCESSOR_CURRENT_API_VERSION` diff --git a/docs/contributing/embedding.md b/docs/contributing/embedding.md index 0d080c92a4..58b796fe64 100644 --- a/docs/contributing/embedding.md +++ b/docs/contributing/embedding.md @@ -43,10 +43,3 @@ Any registered metrics can be computed using using the `ComputeMetric` function. Metrics can also be registered at run time using the `RegisterMetric` and `ExtendMetricsProto` functions. These can subsequently be executed with `ComputeMetric`. WARNING: embedders should ensure that the path of any registered metric is consistent with the name used to execute the metric and output view in the SQL. - -### Creating derived events - -As creating derived events is tied to the metrics subsystem, the `ComputeMetrics` function in the trace processor API should be called with the appropriate metrics. This will create the `_event` table/view which can then be queried using the `ExectueQuery` function. - -NOTE: At some point, there are plans to add an API which does not create the metrics proto but just executes the queries in the metric. - diff --git a/protos/perfetto/metrics/android/BUILD.gn b/protos/perfetto/metrics/android/BUILD.gn index fc3cfb43a8..35a3203fc4 100644 --- a/protos/perfetto/metrics/android/BUILD.gn +++ b/protos/perfetto/metrics/android/BUILD.gn @@ -32,7 +32,6 @@ perfetto_proto_library("@TYPE@") { "android_garbage_collection_unagg_metric.proto", "android_oom_adjuster_metric.proto", "android_sysui_notifications_blocking_calls_metric.proto", - "android_trusty_workqueues.proto", "anr_metric.proto", "app_process_starts_metric.proto", "auto_metric.proto", @@ -66,7 +65,6 @@ perfetto_proto_library("@TYPE@") { "monitor_contention_metric.proto", "multiuser_metric.proto", "network_metric.proto", - "other_traces.proto", "package_list.proto", "powrails_metric.proto", "process_metadata.proto", diff --git a/protos/perfetto/metrics/android/android_trusty_workqueues.proto b/protos/perfetto/metrics/android/android_trusty_workqueues.proto deleted file mode 100644 index b7a1d5a3dd..0000000000 --- a/protos/perfetto/metrics/android/android_trusty_workqueues.proto +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2022 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; - -// Metric used to generate a simplified view of the Trusty kworker events. -message AndroidTrustyWorkqueues {} diff --git a/protos/perfetto/metrics/android/other_traces.proto b/protos/perfetto/metrics/android/other_traces.proto deleted file mode 100644 index 1795ee243d..0000000000 --- a/protos/perfetto/metrics/android/other_traces.proto +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2022 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 AndroidOtherTracesMetric { - // Uuids of other traces being finalized while the current trace was being - // recorded. - repeated string finalized_traces_uuid = 1; -} diff --git a/protos/perfetto/metrics/metrics.proto b/protos/perfetto/metrics/metrics.proto index 622d9730e2..47da583547 100644 --- a/protos/perfetto/metrics/metrics.proto +++ b/protos/perfetto/metrics/metrics.proto @@ -57,7 +57,6 @@ import "protos/perfetto/metrics/android/mem_metric.proto"; import "protos/perfetto/metrics/android/mem_unagg_metric.proto"; import "protos/perfetto/metrics/android/multiuser_metric.proto"; import "protos/perfetto/metrics/android/network_metric.proto"; -import "protos/perfetto/metrics/android/other_traces.proto"; import "protos/perfetto/metrics/android/package_list.proto"; import "protos/perfetto/metrics/android/powrails_metric.proto"; import "protos/perfetto/metrics/android/profiler_smaps.proto"; @@ -67,7 +66,6 @@ import "protos/perfetto/metrics/android/startup_metric.proto"; import "protos/perfetto/metrics/android/surfaceflinger.proto"; import "protos/perfetto/metrics/android/task_names.proto"; import "protos/perfetto/metrics/android/trace_quality.proto"; -import "protos/perfetto/metrics/android/android_trusty_workqueues.proto"; import "protos/perfetto/metrics/android/unsymbolized_frames.proto"; import "protos/perfetto/metrics/android/binder_metric.proto"; import "protos/perfetto/metrics/android/monitor_contention_metric.proto"; @@ -251,11 +249,13 @@ message TraceMetrics { // Metrics for IRQ runtime. optional AndroidIrqRuntimeMetric android_irq_runtime = 43; - // Metrics for the Trusty team. - optional AndroidTrustyWorkqueues android_trusty_workqueues = 44; + // Was metrics for the Trusty team. + reserved 44; + reserved 'android_trusty_workqueues'; - // Summary of other concurrent trace recording. - optional AndroidOtherTracesMetric android_other_traces = 45; + // Was summary of concurrent trace recording. + reserved 45; + reserved 'android_other_traces'; // Per-process Binder transaction metrics. optional AndroidBinderMetric android_binder = 46; diff --git a/protos/perfetto/metrics/perfetto_merged_metrics.proto b/protos/perfetto/metrics/perfetto_merged_metrics.proto index f717359a5b..f69f834d99 100644 --- a/protos/perfetto/metrics/perfetto_merged_metrics.proto +++ b/protos/perfetto/metrics/perfetto_merged_metrics.proto @@ -527,13 +527,6 @@ message AndroidSysUINotificationsBlockingCallsMetric { // End of protos/perfetto/metrics/android/android_sysui_notifications_blocking_calls_metric.proto -// Begin of protos/perfetto/metrics/android/android_trusty_workqueues.proto - -// Metric used to generate a simplified view of the Trusty kworker events. -message AndroidTrustyWorkqueues {} - -// End of protos/perfetto/metrics/android/android_trusty_workqueues.proto - // Begin of protos/perfetto/metrics/android/anr_metric.proto message AndroidAnrMetric { @@ -2120,16 +2113,6 @@ message AndroidNetworkMetric { // End of protos/perfetto/metrics/android/network_metric.proto -// Begin of protos/perfetto/metrics/android/other_traces.proto - -message AndroidOtherTracesMetric { - // Uuids of other traces being finalized while the current trace was being - // recorded. - repeated string finalized_traces_uuid = 1; -} - -// End of protos/perfetto/metrics/android/other_traces.proto - // Begin of protos/perfetto/metrics/android/package_list.proto message AndroidPackageList { @@ -3152,11 +3135,13 @@ message TraceMetrics { // Metrics for IRQ runtime. optional AndroidIrqRuntimeMetric android_irq_runtime = 43; - // Metrics for the Trusty team. - optional AndroidTrustyWorkqueues android_trusty_workqueues = 44; + // Was metrics for the Trusty team. + reserved 44; + reserved 'android_trusty_workqueues'; - // Summary of other concurrent trace recording. - optional AndroidOtherTracesMetric android_other_traces = 45; + // Was summary of concurrent trace recording. + reserved 45; + reserved 'android_other_traces'; // Per-process Binder transaction metrics. optional AndroidBinderMetric android_binder = 46; diff --git a/python/perfetto/trace_processor/metrics.descriptor b/python/perfetto/trace_processor/metrics.descriptor index 9fa041de67..00454f6f14 100644 --- a/python/perfetto/trace_processor/metrics.descriptor +++ b/python/perfetto/trace_processor/metrics.descriptor @@ -956,10 +956,6 @@ runtime_ms (R runtimeMs$ core ( 2>.perfetto.protos.AndroidNetworkMetric.CoreNetTxActionStatisticRcore[ IpiActionN total ( 28.perfetto.protos.AndroidNetworkMetric.IpiActionStatisticRtotal -� -2protos/perfetto/metrics/android/other_traces.protoperfetto.protos"N -AndroidOtherTracesMetric2 -finalized_traces_uuid ( RfinalizedTracesUuid � 2protos/perfetto/metrics/android/package_list.protoperfetto.protos"� AndroidPackageListG @@ -1262,9 +1258,6 @@ threadName failures ( 22.perfetto.protos.AndroidTraceQualityMetric.FailureRfailures Failure name ( Rname -m -?protos/perfetto/metrics/android/android_trusty_workqueues.protoperfetto.protos" -AndroidTrustyWorkqueues � 9protos/perfetto/metrics/android/unsymbolized_frames.protoperfetto.protos"� UnsymbolizedFramesA @@ -1495,8 +1488,8 @@ threadName! thread_id (RthreadId process_id (R processId -�R -%protos/perfetto/metrics/metrics.protoperfetto.protos8protos/perfetto/metrics/android/ad_services_metric.proto2protos/perfetto/metrics/android/android_boot.proto8protos/perfetto/metrics/android/android_boot_unagg.protoMprotos/perfetto/metrics/android/android_garbage_collection_unagg_metric.proto1protos/perfetto/metrics/android/auto_metric.protoKprotos/perfetto/metrics/android/sysui_notif_shade_list_builder_metric.protoRprotos/perfetto/metrics/android/sysui_update_notif_on_ui_mode_changed_metric.protoCprotos/perfetto/metrics/android/android_frame_timeline_metric.proto0protos/perfetto/metrics/android/anr_metric.proto1protos/perfetto/metrics/android/batt_metric.protoWprotos/perfetto/metrics/android/android_sysui_notifications_blocking_calls_metric.protoGprotos/perfetto/metrics/android/android_blocking_calls_cuj_metric.protoBprotos/perfetto/metrics/android/android_blocking_calls_unagg.proto3protos/perfetto/metrics/android/codec_metrics.proto0protos/perfetto/metrics/android/cpu_metric.proto3protos/perfetto/metrics/android/camera_metric.proto9protos/perfetto/metrics/android/camera_unagg_metric.proto5protos/perfetto/metrics/android/display_metrics.proto5protos/perfetto/metrics/android/dma_heap_metric.proto1protos/perfetto/metrics/android/dvfs_metric.proto4protos/perfetto/metrics/android/fastrpc_metric.proto0protos/perfetto/metrics/android/g2d_metric.proto0protos/perfetto/metrics/android/gpu_metric.proto0protos/perfetto/metrics/android/hwcomposer.proto1protos/perfetto/metrics/android/hwui_metric.proto/protos/perfetto/metrics/android/io_metric.proto5protos/perfetto/metrics/android/io_unagg_metric.proto0protos/perfetto/metrics/android/ion_metric.proto8protos/perfetto/metrics/android/irq_runtime_metric.proto5protos/perfetto/metrics/android/jank_cuj_metric.proto9protos/perfetto/metrics/android/java_heap_histogram.proto;protos/perfetto/metrics/android/java_heap_class_stats.proto5protos/perfetto/metrics/android/java_heap_stats.proto0protos/perfetto/metrics/android/lmk_metric.proto7protos/perfetto/metrics/android/lmk_reason_metric.proto0protos/perfetto/metrics/android/mem_metric.proto6protos/perfetto/metrics/android/mem_unagg_metric.proto6protos/perfetto/metrics/android/multiuser_metric.proto4protos/perfetto/metrics/android/network_metric.proto2protos/perfetto/metrics/android/other_traces.proto2protos/perfetto/metrics/android/package_list.proto5protos/perfetto/metrics/android/powrails_metric.proto4protos/perfetto/metrics/android/profiler_smaps.proto7protos/perfetto/metrics/android/rt_runtime_metric.proto0protos/perfetto/metrics/android/simpleperf.proto4protos/perfetto/metrics/android/startup_metric.proto4protos/perfetto/metrics/android/surfaceflinger.proto0protos/perfetto/metrics/android/task_names.proto3protos/perfetto/metrics/android/trace_quality.proto?protos/perfetto/metrics/android/android_trusty_workqueues.proto9protos/perfetto/metrics/android/unsymbolized_frames.proto3protos/perfetto/metrics/android/binder_metric.proto?protos/perfetto/metrics/android/monitor_contention_metric.protoCprotos/perfetto/metrics/android/monitor_contention_agg_metric.proto?protos/perfetto/metrics/android/app_process_starts_metric.protoAprotos/perfetto/metrics/android/android_oom_adjuster_metric.proto?protos/perfetto/metrics/android/android_broadcasts_metric.proto= process.start_ts OR process.start_ts IS NULL) - AND (raw_events.ts < process.end_ts OR process.end_ts IS NULL) - WHERE raw_events.pid != 0 -) -SELECT - 'slice' AS track_type, - 'Low Memory Kills (LMKs)' AS track_name, - ts, - dur, - CASE - WHEN process_name IS NULL THEN printf('Process %d', lmk.pid) - ELSE printf('%s (pid: %d)', process_name, lmk.pid) - END AS slice_name -FROM lmks_with_proc_name AS lmk; - DROP VIEW IF EXISTS android_lmk_output; CREATE PERFETTO VIEW android_lmk_output AS WITH lmk_counts AS ( diff --git a/src/trace_processor/metrics/sql/android/android_other_traces.sql b/src/trace_processor/metrics/sql/android/android_other_traces.sql deleted file mode 100644 index 367de23d5f..0000000000 --- a/src/trace_processor/metrics/sql/android/android_other_traces.sql +++ /dev/null @@ -1,47 +0,0 @@ --- --- Copyright 2022 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. --- - -DROP VIEW IF EXISTS android_other_traces_view; -CREATE PERFETTO VIEW android_other_traces_view AS -SELECT - ts, - dur, - SUBSTR(slice.name, 15) AS uuid, - 'Finalize' AS event_type -FROM slice -JOIN track - ON track.name = 'OtherTraces' AND slice.track_id = track.id -WHERE - slice.name GLOB 'finalize-uuid-*'; - -DROP VIEW IF EXISTS android_other_traces_event; -CREATE PERFETTO VIEW android_other_traces_event AS -SELECT - 'slice' AS track_type, - 'Other Traces' AS track_name, - ts, - dur, - event_type || ' ' || uuid AS slice_name -FROM android_other_traces_view; - -DROP VIEW IF EXISTS android_other_traces_output; -CREATE PERFETTO VIEW android_other_traces_output AS -SELECT AndroidOtherTracesMetric( - 'finalized_traces_uuid', ( - SELECT RepeatedField(uuid) - FROM android_other_traces_view - WHERE event_type = 'Finalize') - ); diff --git a/src/trace_processor/metrics/sql/android/android_surfaceflinger.sql b/src/trace_processor/metrics/sql/android/android_surfaceflinger.sql index a24bc9b748..1801d33228 100644 --- a/src/trace_processor/metrics/sql/android/android_surfaceflinger.sql +++ b/src/trace_processor/metrics/sql/android/android_surfaceflinger.sql @@ -29,17 +29,6 @@ SELECT RUN_METRIC( 'output', 'gpu_frame_missed' ); -DROP VIEW IF EXISTS android_surfaceflinger_event; -CREATE PERFETTO VIEW android_surfaceflinger_event AS -SELECT - 'slice' AS track_type, - 'Android Missed Frames' AS track_name, - ts, - dur, - 'Frame missed' AS slice_name -FROM frame_missed -WHERE value = 1 AND ts IS NOT NULL; - DROP VIEW IF EXISTS surfaceflinger_track; CREATE PERFETTO VIEW surfaceflinger_track AS SELECT tr.id AS track_id, t.utid, t.tid diff --git a/src/trace_processor/metrics/sql/android/android_trusty_workqueues.sql b/src/trace_processor/metrics/sql/android/android_trusty_workqueues.sql deleted file mode 100644 index d34b225b88..0000000000 --- a/src/trace_processor/metrics/sql/android/android_trusty_workqueues.sql +++ /dev/null @@ -1,21 +0,0 @@ --- Gather the `nop_work_func` slices and the CPU they each ran on and use that --- information to generate a metric that displays just the Trusty workqueue --- events grouped by CPU. -DROP VIEW IF EXISTS android_trusty_workqueues_event; -CREATE PERFETTO VIEW android_trusty_workqueues_event AS -SELECT - 'slice' AS track_type, - name AS slice_name, - ts, - dur, - 'Cpu ' || EXTRACT_ARG(arg_set_id, 'cpu') AS track_name, - 'Trusty Workqueues' AS group_name -FROM slice -WHERE slice.name GLOB 'nop_work_func*'; - --- Generate the final metric output. This is empty because we're only using the --- metric to generate custom tracks, and so don't have any aggregate data to --- generate. -DROP VIEW IF EXISTS android_trusty_workqueues_output; -CREATE PERFETTO VIEW android_trusty_workqueues_output AS -SELECT AndroidTrustyWorkqueues(); diff --git a/src/trace_processor/metrics/sql/experimental/chrome_dropped_frames.sql b/src/trace_processor/metrics/sql/experimental/chrome_dropped_frames.sql index 2c33bc03cb..1fef9b10d3 100644 --- a/src/trace_processor/metrics/sql/experimental/chrome_dropped_frames.sql +++ b/src/trace_processor/metrics/sql/experimental/chrome_dropped_frames.sql @@ -53,36 +53,6 @@ FROM dropped_frames_with_upid JOIN process ON dropped_frames_with_upid.upid = process.upid; --- Create the derived event track for dropped frames. --- All tracks generated from chrome_dropped_frames_event are --- placed under a track group named 'Dropped Frames', whose summary --- track is the first track ('All Processes') in chrome_dropped_frames_event. --- Note that the 'All Processes' track is generated only when dropped frames --- come from more than one origin process. -DROP VIEW IF EXISTS chrome_dropped_frames_event; -CREATE PERFETTO VIEW chrome_dropped_frames_event AS -SELECT - 'slice' AS track_type, - 'All Processes' AS track_name, - ts, - 0 AS dur, - 'Dropped Frame' AS slice_name, - 'Dropped Frames' AS group_name -FROM dropped_frames_with_process_info -WHERE (SELECT COUNT(DISTINCT process_id) - FROM dropped_frames_with_process_info) > 1 -GROUP BY ts -UNION ALL -SELECT - 'slice' AS track_type, - COALESCE(process_name, 'Process') || ' ' || process_id AS track_name, - ts, - 0 AS dur, - 'Dropped Frame' AS slice_name, - 'Dropped Frames' AS group_name -FROM dropped_frames_with_process_info -GROUP BY process_id, ts; - -- Create the dropped frames metric output. DROP VIEW IF EXISTS chrome_dropped_frames_output; CREATE PERFETTO VIEW chrome_dropped_frames_output AS diff --git a/src/trace_processor/metrics/sql/experimental/chrome_long_latency.sql b/src/trace_processor/metrics/sql/experimental/chrome_long_latency.sql index d8b49c6eb5..d8e1eb23e8 100644 --- a/src/trace_processor/metrics/sql/experimental/chrome_long_latency.sql +++ b/src/trace_processor/metrics/sql/experimental/chrome_long_latency.sql @@ -63,36 +63,6 @@ JOIN process ON long_latency_with_upid.upid = process.upid GROUP BY ts, process.pid; --- Create the derived event track for long latency. --- All tracks generated from chrome_long_latency_event are --- placed under a track group named 'Long Latency', whose summary --- track is the first track ('All Processes') in chrome_long_latency_event. --- Note that the 'All Processes' track is generated only when there are more --- than one source of long latency events. -DROP VIEW IF EXISTS chrome_long_latency_event; -CREATE PERFETTO VIEW chrome_long_latency_event AS -SELECT - 'slice' AS track_type, - 'All Processes' AS track_name, - ts, - 0 AS dur, - event_type AS slice_name, - 'Long Latency' AS group_name -FROM long_latency_with_process_info -WHERE (SELECT COUNT(DISTINCT process_id) - FROM long_latency_with_process_info) > 1 -GROUP BY ts -UNION ALL -SELECT - 'slice' AS track_type, - process_name || ' ' || process_id AS track_name, - ts, - 0 AS dur, - event_type AS slice_name, - 'Long Latency' AS group_name -FROM long_latency_with_process_info -GROUP BY ts; - -- Create the long latency metric output. DROP VIEW IF EXISTS chrome_long_latency_output; CREATE PERFETTO VIEW chrome_long_latency_output AS diff --git a/test/data/ui-screenshots/chrome_missing_track_names.test.ts/expand-all-tracks/all-tracks-expanded.png.sha256 b/test/data/ui-screenshots/chrome_missing_track_names.test.ts/expand-all-tracks/all-tracks-expanded.png.sha256 index bf6b6770d8..82c67b1ee6 100644 --- a/test/data/ui-screenshots/chrome_missing_track_names.test.ts/expand-all-tracks/all-tracks-expanded.png.sha256 +++ b/test/data/ui-screenshots/chrome_missing_track_names.test.ts/expand-all-tracks/all-tracks-expanded.png.sha256 @@ -1 +1 @@ -3b69444c0aa07f3bd731b667abcfb2cf8a3d533763f023d89302897964d75600 \ No newline at end of file +14e01d04116af09d67859c27dc2e379e75023062e5112e4b8d2c02c75741cfed \ No newline at end of file diff --git a/test/data/ui-screenshots/chrome_missing_track_names.test.ts/trace-loaded/trace-loaded.png.sha256 b/test/data/ui-screenshots/chrome_missing_track_names.test.ts/trace-loaded/trace-loaded.png.sha256 index 12cce91eda..ce1401a7bb 100644 --- a/test/data/ui-screenshots/chrome_missing_track_names.test.ts/trace-loaded/trace-loaded.png.sha256 +++ b/test/data/ui-screenshots/chrome_missing_track_names.test.ts/trace-loaded/trace-loaded.png.sha256 @@ -1 +1 @@ -0b249677daf7d79a5c9ab01dc73dba560b4bcdbcb69b68d855e8e67f712cc953 \ No newline at end of file +440c8787bcb478bbc03e7d463bc79b1130de54478bdde12e8a6af01ab02d7478 \ No newline at end of file diff --git a/test/data/ui-screenshots/chrome_rendering_desktop.test.ts/load-trace/loaded.png.sha256 b/test/data/ui-screenshots/chrome_rendering_desktop.test.ts/load-trace/loaded.png.sha256 index 8c0b04e4d6..fe19bb3f6d 100644 --- a/test/data/ui-screenshots/chrome_rendering_desktop.test.ts/load-trace/loaded.png.sha256 +++ b/test/data/ui-screenshots/chrome_rendering_desktop.test.ts/load-trace/loaded.png.sha256 @@ -1 +1 @@ -3dde3619c184fb32018642cb0e4b3150301a31971b197709eaeb8d22da55f462 \ No newline at end of file +900d1044bdb887dc2a5919a5cb78f0f5ed32b341b5e08614d06e76a923a47807 \ No newline at end of file diff --git a/test/data/ui-screenshots/chrome_rendering_desktop.test.ts/slice-with-flows/slice-with-flows.png.sha256 b/test/data/ui-screenshots/chrome_rendering_desktop.test.ts/slice-with-flows/slice-with-flows.png.sha256 index c9af872fa9..2ccfd04448 100644 --- a/test/data/ui-screenshots/chrome_rendering_desktop.test.ts/slice-with-flows/slice-with-flows.png.sha256 +++ b/test/data/ui-screenshots/chrome_rendering_desktop.test.ts/slice-with-flows/slice-with-flows.png.sha256 @@ -1 +1 @@ -e7d2706672980e9af7949f4f19897f02420ea7ad620a2e71b9677a14734939cb \ No newline at end of file +0288073a89eb027fb668a4450a41174e83498b0ca24b2281f9fea1da1920cd5d \ No newline at end of file diff --git a/test/trace_processor/diff_tests/metrics/graphics/tests.py b/test/trace_processor/diff_tests/metrics/graphics/tests.py index 28a1f668ac..cc514a2e4e 100644 --- a/test/trace_processor/diff_tests/metrics/graphics/tests.py +++ b/test/trace_processor/diff_tests/metrics/graphics/tests.py @@ -20,23 +20,6 @@ class GraphicsMetrics(TestSuite): - # Android SurfaceFlinger metrics - def test_frame_missed_event_frame_missed(self): - return DiffTestBlueprint( - trace=Path('frame_missed.py'), - query=""" - SELECT RUN_METRIC('android/android_surfaceflinger.sql'); - - SELECT ts, dur - FROM android_surfaceflinger_event; - """, - out=Csv(""" - "ts","dur" - 100,1 - 102,1 - 103,1 - """)) - def test_frame_missed_metrics(self): return DiffTestBlueprint( trace=Path('frame_missed.py'), diff --git a/test/trace_processor/diff_tests/parser/parsing/otheruuids.textproto b/test/trace_processor/diff_tests/parser/parsing/otheruuids.textproto deleted file mode 100644 index e5281e8e0c..0000000000 --- a/test/trace_processor/diff_tests/parser/parsing/otheruuids.textproto +++ /dev/null @@ -1,46 +0,0 @@ -packet { - ftrace_events { - cpu: 4 - event { - timestamp: 171311335293 - pid: 7663 - print { - buf: "N|7663|OtherTraces|finalize-uuid-75e4c6d0-d8f6-4f82-fa4b-9e09c5512288\n" - } - } - } - trusted_uid: 9999 - trusted_packet_sequence_id: 2 - trusted_pid: 1277 - previous_packet_dropped: true -} -packet { - ftrace_events { - cpu: 4 - event { - timestamp: 187198579688 - pid: 7752 - print { - buf: "N|7752|OtherTraces|finalize-uuid-ad836701-3113-3fb1-be4f-f7731e23fbbf\n" - } - } - } - trusted_uid: 9999 - trusted_packet_sequence_id: 2 - trusted_pid: 1277 -} -packet { - ftrace_events { - cpu: 6 - event { - timestamp: 200857707872 - pid: 7824 - print { - buf: "N|7824|OtherTraces|finalize-uuid-0de1a010-efa1-a081-2345-969b1186a6ab\n" - } - } - } - trusted_uid: 9999 - trusted_packet_sequence_id: 2 - trusted_pid: 1277 -} diff --git a/test/trace_processor/diff_tests/parser/parsing/tests.py b/test/trace_processor/diff_tests/parser/parsing/tests.py index 42fa637070..54707c140a 100644 --- a/test/trace_processor/diff_tests/parser/parsing/tests.py +++ b/test/trace_processor/diff_tests/parser/parsing/tests.py @@ -1141,18 +1141,6 @@ def test_atrace_uncompressed_sched_count(self): 9 """)) - def test_otheruuids_android_other_traces(self): - return DiffTestBlueprint( - trace=Path('otheruuids.textproto'), - query=Metric('android_other_traces'), - out=TextProto(r""" - android_other_traces { - finalized_traces_uuid: "75e4c6d0-d8f6-4f82-fa4b-9e09c5512288" - finalized_traces_uuid: "ad836701-3113-3fb1-be4f-f7731e23fbbf" - finalized_traces_uuid: "0de1a010-efa1-a081-2345-969b1186a6ab" - } - """)) - # Per-process Binder transaction metrics def test_android_binder(self): return DiffTestBlueprint( diff --git a/ui/src/core/load_trace.ts b/ui/src/core/load_trace.ts index 98685cd4f8..9e512d3b75 100644 --- a/ui/src/core/load_trace.ts +++ b/ui/src/core/load_trace.ts @@ -19,7 +19,7 @@ import { getEnabledMetatracingCategories, isMetatracingEnabled, } from './metatracing'; -import {featureFlags, Flag} from './feature_flags'; +import {featureFlags} from './feature_flags'; import {Engine, EngineBase} from '../trace_processor/engine'; import {HttpRpcEngine} from '../trace_processor/http_rpc_engine'; import { @@ -27,7 +27,6 @@ import { LONG_NULL, NUM, NUM_NULL, - QueryError, STR, STR_NULL, } from '../trace_processor/query_result'; @@ -52,31 +51,6 @@ import {TraceSource} from '../public/trace_source'; import {ThreadDesc} from '../public/threads'; import {Router} from '../core/router'; -const METRICS = [ - 'android_ion', - 'android_lmk', - 'android_surfaceflinger', - 'android_batt', - 'android_other_traces', - 'chrome_dropped_frames', - // TODO(289365196): Reenable: - // 'chrome_long_latency', - 'android_trusty_workqueues', -]; -const FLAGGED_METRICS: Array<[Flag, string]> = METRICS.map((m) => { - const id = `forceMetric${m}`; - let name = m.split('_').join(' '); - name = name[0].toUpperCase() + name.slice(1); - name = 'Metric: ' + name; - const flag = featureFlags.register({ - id, - name, - description: `Overrides running the '${m}' metric at import time.`, - defaultValue: true, - }); - return [flag, m]; -}); - const ENABLE_CHROME_RELIABLE_RANGE_ZOOM_FLAG = featureFlags.register({ id: 'enableChromeReliableRangeZoom', name: 'Enable Chrome reliable range zoom', @@ -252,7 +226,6 @@ async function loadTraceIntoEngine( Router.navigate(`#!/viewer?local_cache_key=${cacheUuid}`); // Make sure the helper views are available before we start adding tracks. - await initialiseHelperViews(trace); await includeSummaryTables(trace); await defineMaxLayoutDepthSqlFunction(engine); @@ -344,181 +317,6 @@ async function listThreads(trace: TraceImpl) { trace.setThreads(threads); } -async function initialiseHelperViews(trace: TraceImpl) { - const engine = trace.engine; - updateStatus(trace, 'Creating annotation counter track table'); - // Create the helper tables for all the annotations related data. - // NULL in min/max means "figure it out per track in the usual way". - await engine.query(` - CREATE TABLE annotation_counter_track( - id INTEGER PRIMARY KEY, - name STRING, - __metric_name STRING, - upid INTEGER, - min_value DOUBLE, - max_value DOUBLE - ); - `); - updateStatus(trace, 'Creating annotation slice track table'); - await engine.query(` - CREATE TABLE annotation_slice_track( - id INTEGER PRIMARY KEY, - name STRING, - __metric_name STRING, - upid INTEGER, - group_name STRING - ); - `); - - updateStatus(trace, 'Creating annotation counter table'); - await engine.query(` - CREATE TABLE annotation_counter( - id BIGINT, - track_id INT, - ts BIGINT, - value DOUBLE, - PRIMARY KEY (track_id, ts) - ) WITHOUT ROWID; - `); - updateStatus(trace, 'Creating annotation slice table'); - await engine.query(` - CREATE TABLE annotation_slice( - id INTEGER PRIMARY KEY, - track_id INT, - ts BIGINT, - dur BIGINT, - thread_dur BIGINT, - depth INT, - cat STRING, - name STRING, - UNIQUE(track_id, ts) - ); - `); - - const availableMetrics = []; - const metricsResult = await engine.query('select name from trace_metrics'); - for (const it = metricsResult.iter({name: STR}); it.valid(); it.next()) { - availableMetrics.push(it.name); - } - - const availableMetricsSet = new Set(availableMetrics); - for (const [flag, metric] of FLAGGED_METRICS) { - if (!flag.get() || !availableMetricsSet.has(metric)) { - continue; - } - - updateStatus(trace, `Computing ${metric} metric`); - - try { - // We don't care about the actual result of metric here as we are just - // interested in the annotation tracks. - await engine.computeMetric([metric], 'proto'); - } catch (e) { - if (e instanceof QueryError) { - trace.addLoadingError('MetricError: ' + e.message); - continue; - } else { - throw e; - } - } - - updateStatus(trace, `Inserting data for ${metric} metric`); - try { - const result = await engine.query(`pragma table_info(${metric}_event)`); - let hasSliceName = false; - let hasDur = false; - let hasUpid = false; - let hasValue = false; - let hasGroupName = false; - const it = result.iter({name: STR}); - for (; it.valid(); it.next()) { - const name = it.name; - hasSliceName = hasSliceName || name === 'slice_name'; - hasDur = hasDur || name === 'dur'; - hasUpid = hasUpid || name === 'upid'; - hasValue = hasValue || name === 'value'; - hasGroupName = hasGroupName || name === 'group_name'; - } - - const upidColumnSelect = hasUpid ? 'upid' : '0 AS upid'; - const upidColumnWhere = hasUpid ? 'upid' : '0'; - const groupNameColumn = hasGroupName - ? 'group_name' - : 'NULL AS group_name'; - if (hasSliceName && hasDur) { - await engine.query(` - INSERT INTO annotation_slice_track( - name, __metric_name, upid, group_name) - SELECT DISTINCT - track_name, - '${metric}' as metric_name, - ${upidColumnSelect}, - ${groupNameColumn} - FROM ${metric}_event - WHERE track_type = 'slice' - `); - await engine.query(` - INSERT INTO annotation_slice( - track_id, ts, dur, thread_dur, depth, cat, name - ) - SELECT - t.id AS track_id, - ts, - dur, - NULL as thread_dur, - 0 AS depth, - a.track_name as cat, - slice_name AS name - FROM ${metric}_event a - JOIN annotation_slice_track t - ON a.track_name = t.name AND t.__metric_name = '${metric}' - ORDER BY t.id, ts - `); - } - - if (hasValue) { - const minMax = await engine.query(` - SELECT - IFNULL(MIN(value), 0) as minValue, - IFNULL(MAX(value), 0) as maxValue - FROM ${metric}_event - WHERE ${upidColumnWhere} != 0`); - const row = minMax.firstRow({minValue: NUM, maxValue: NUM}); - await engine.query(` - INSERT INTO annotation_counter_track( - name, __metric_name, min_value, max_value, upid) - SELECT DISTINCT - track_name, - '${metric}' as metric_name, - CASE ${upidColumnWhere} WHEN 0 THEN NULL ELSE ${row.minValue} END, - CASE ${upidColumnWhere} WHEN 0 THEN NULL ELSE ${row.maxValue} END, - ${upidColumnSelect} - FROM ${metric}_event - WHERE track_type = 'counter' - `); - await engine.query(` - INSERT INTO annotation_counter(id, track_id, ts, value) - SELECT - -1 as id, - t.id AS track_id, - ts, - value - FROM ${metric}_event a - JOIN annotation_counter_track t - ON a.track_name = t.name AND t.__metric_name = '${metric}' - ORDER BY t.id, ts - `); - } - } catch (e) { - if (e instanceof QueryError) { - trace.addLoadingError('MetricError: ' + e.message); - } else { - throw e; - } - } - } -} - async function includeSummaryTables(trace: TraceImpl) { const engine = trace.engine; updateStatus(trace, 'Creating slice summaries'); diff --git a/ui/src/core_plugins/annotation/index.ts b/ui/src/core_plugins/annotation/index.ts deleted file mode 100644 index 975cff8e41..0000000000 --- a/ui/src/core_plugins/annotation/index.ts +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (C) 2021 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 {COUNTER_TRACK_KIND} from '../../public/track_kinds'; -import {Trace} from '../../public/trace'; -import {PerfettoPlugin, PluginDescriptor} from '../../public/plugin'; -import {ThreadSliceTrack} from '../../frontend/thread_slice_track'; -import {NUM, NUM_NULL, STR, STR_NULL} from '../../trace_processor/query_result'; -import {TraceProcessorCounterTrack} from '../counter/trace_processor_counter_track'; -import {SLICE_TRACK_KIND} from '../../public/track_kinds'; -import {TrackNode, type TrackNodeContainer} from '../../public/workspace'; -import {getOrCreateGroupForProcess} from '../../public/standard_groups'; - -class AnnotationPlugin implements PerfettoPlugin { - async onTraceLoad(ctx: Trace): Promise { - await this.addAnnotationTracks(ctx); - await this.addAnnotationCounterTracks(ctx); - } - - private async addAnnotationTracks(ctx: Trace) { - const {engine} = ctx; - - const result = await engine.query(` - select - id, - name, - upid, - group_name as groupName - from annotation_slice_track - order by name - `); - - const it = result.iter({ - id: NUM, - name: STR, - upid: NUM, - groupName: STR_NULL, - }); - - const groups = new Map(); - - for (; it.valid(); it.next()) { - const {id, name, upid, groupName} = it; - - const uri = `/annotation_${id}`; - ctx.tracks.registerTrack({ - uri, - title: name, - tags: { - kind: SLICE_TRACK_KIND, - scope: 'annotation', - upid, - }, - chips: ['metric'], - track: new ThreadSliceTrack( - { - trace: ctx, - uri, - }, - id, - 0, - 'annotation_slice', - ), - }); - - // We want to try and find a group to put this track in. If groupName is - // defined, create a new group or place in existing one if it already - // exists Otherwise, try upid to see if we can put this in a process - // group - - let container: TrackNodeContainer; - if (groupName) { - const existingGroup = groups.get(groupName); - if (!existingGroup) { - const group = new TrackNode({title: groupName, uri, isSummary: true}); - container = group; - groups.set(groupName, group); - ctx.workspace.addChildInOrder(group); - } else { - container = existingGroup; - } - } else { - if (upid !== 0) { - container = getOrCreateGroupForProcess(ctx.workspace, upid); - } else { - container = ctx.workspace; - } - } - - const track = new TrackNode({uri, title: name}); - container.addChildInOrder(track); - } - } - - private async addAnnotationCounterTracks(ctx: Trace) { - const {engine} = ctx; - const counterResult = await engine.query(` - SELECT - id, - name, - min_value as minValue, - max_value as maxValue, - upid - FROM annotation_counter_track`); - - const counterIt = counterResult.iter({ - id: NUM, - name: STR, - minValue: NUM_NULL, - maxValue: NUM_NULL, - upid: NUM, - }); - - for (; counterIt.valid(); counterIt.next()) { - const {id: trackId, name, upid} = counterIt; - - const uri = `/annotation_counter_${trackId}`; - ctx.tracks.registerTrack({ - uri, - title: name, - tags: { - kind: COUNTER_TRACK_KIND, - scope: 'annotation', - upid, - }, - chips: ['metric'], - track: new TraceProcessorCounterTrack({ - trace: ctx, - uri, - trackId, - rootTable: 'annotation_counter', - }), - }); - - const group = getOrCreateGroupForProcess(ctx.workspace, upid); - const track = new TrackNode({uri, title: name}); - group.addChildInOrder(track); - } - } -} - -export const plugin: PluginDescriptor = { - pluginId: 'perfetto.Annotation', - plugin: AnnotationPlugin, -}; diff --git a/ui/src/core_plugins/async_slices/index.ts b/ui/src/core_plugins/async_slices/index.ts index ef2da757ed..65f2b4a9c6 100644 --- a/ui/src/core_plugins/async_slices/index.ts +++ b/ui/src/core_plugins/async_slices/index.ts @@ -167,7 +167,7 @@ class AsyncSlicePlugin implements PerfettoPlugin { scope: 'global', }, track: new AsyncSliceTrack({trace: ctx, uri}, maxDepth, trackIds), - detailsPanel: () => new ThreadSliceDetailsPanel(ctx, 'slice'), + detailsPanel: () => new ThreadSliceDetailsPanel(ctx), }); const trackNode = new TrackNode({ uri, @@ -251,7 +251,7 @@ class AsyncSlicePlugin implements PerfettoPlugin { upid, }, track: new AsyncSliceTrack({trace: ctx, uri}, maxDepth, trackIds), - detailsPanel: () => new ThreadSliceDetailsPanel(ctx, 'slice'), + detailsPanel: () => new ThreadSliceDetailsPanel(ctx), }); const track = new TrackNode({uri, title, sortOrder: 30}); trackIds.forEach((id) => { @@ -350,7 +350,7 @@ class AsyncSlicePlugin implements PerfettoPlugin { isKernelThread === 0 && isMainThread === 1 && 'main thread', ]), track: new AsyncSliceTrack({trace: ctx, uri}, maxDepth, trackIds), - detailsPanel: () => new ThreadSliceDetailsPanel(ctx, 'slice'), + detailsPanel: () => new ThreadSliceDetailsPanel(ctx), }); const track = new TrackNode({uri, title, sortOrder: 20}); trackIds.forEach((id) => { @@ -430,7 +430,7 @@ class AsyncSlicePlugin implements PerfettoPlugin { kind: SLICE_TRACK_KIND, }, track: new AsyncSliceTrack({trace: ctx, uri}, maxDepth, trackIds), - detailsPanel: () => new ThreadSliceDetailsPanel(ctx, 'slice'), + detailsPanel: () => new ThreadSliceDetailsPanel(ctx), }); const track = new TrackNode({uri, title}); diff --git a/ui/src/core_plugins/frames/index.ts b/ui/src/core_plugins/frames/index.ts index 54fed93f05..5d202e1b5f 100644 --- a/ui/src/core_plugins/frames/index.ts +++ b/ui/src/core_plugins/frames/index.ts @@ -87,7 +87,7 @@ class FramesPlugin implements PerfettoPlugin { upid, kind: EXPECTED_FRAMES_SLICE_TRACK_KIND, }, - detailsPanel: () => new ThreadSliceDetailsPanel(ctx, 'slice'), + detailsPanel: () => new ThreadSliceDetailsPanel(ctx), }); const group = getOrCreateGroupForProcess(ctx.workspace, upid); const track = new TrackNode({uri, title, sortOrder: -50}); @@ -151,7 +151,7 @@ class FramesPlugin implements PerfettoPlugin { trackIds, kind: ACTUAL_FRAMES_SLICE_TRACK_KIND, }, - detailsPanel: () => new ThreadSliceDetailsPanel(ctx, 'slice'), + detailsPanel: () => new ThreadSliceDetailsPanel(ctx), }); const group = getOrCreateGroupForProcess(ctx.workspace, upid); const track = new TrackNode({uri, title, sortOrder: -50}); diff --git a/ui/src/frontend/thread_slice_details_tab.ts b/ui/src/frontend/thread_slice_details_tab.ts index 9e31dad8b8..85269f3d41 100644 --- a/ui/src/frontend/thread_slice_details_tab.ts +++ b/ui/src/frontend/thread_slice_details_tab.ts @@ -14,10 +14,9 @@ import m from 'mithril'; import {Icons} from '../base/semantic_icons'; -import {Time, TimeSpan} from '../base/time'; +import {TimeSpan} from '../base/time'; import {exists} from '../base/utils'; import {Engine} from '../trace_processor/engine'; -import {LONG, LONG_NULL, NUM, STR_NULL} from '../trace_processor/query_result'; import {Button} from '../widgets/button'; import {DetailsShell} from '../widgets/details_shell'; import {GridLayout, GridLayoutColumn} from '../widgets/grid_layout'; @@ -200,71 +199,22 @@ function getSliceContextMenuItems(slice: SliceDetails) { return ITEMS.filter((item) => item.shouldDisplay(slice)); } -async function getAnnotationSlice( - engine: Engine, - id: number, -): Promise { - const query = await engine.query(` - SELECT - id, - name, - ts, - dur, - track_id as trackId, - thread_dur as threadDur, - cat, - ABS_TIME_STR(ts) as absTime - FROM annotation_slice - where id = ${id}`); - - const it = query.firstRow({ - id: NUM, - name: STR_NULL, - ts: LONG, - dur: LONG, - trackId: NUM, - threadDur: LONG_NULL, - cat: STR_NULL, - absTime: STR_NULL, - }); - - return { - id: asSliceSqlId(it.id), - name: it.name ?? 'null', - ts: Time.fromRaw(it.ts), - dur: it.dur, - depth: 0, - trackId: it.trackId, - threadDur: it.threadDur ?? undefined, - category: it.cat ?? undefined, - absTime: it.absTime ?? undefined, - }; -} - async function getSliceDetails( engine: Engine, id: number, - table: string, ): Promise { - if (table === 'annotation_slice') { - return getAnnotationSlice(engine, id); - } else { - return getSlice(engine, asSliceSqlId(id)); - } + return getSlice(engine, asSliceSqlId(id)); } export class ThreadSliceDetailsPanel implements TrackEventDetailsPanel { private sliceDetails?: SliceDetails; private breakdownByThreadState?: BreakdownByThreadState; - constructor( - private readonly trace: Trace, - private readonly tableName: string, - ) {} + constructor(private readonly trace: Trace) {} async load({eventId}: TrackEventSelection) { - const {trace, tableName} = this; - const details = await getSliceDetails(trace.engine, eventId, tableName); + const {trace} = this; + const details = await getSliceDetails(trace.engine, eventId); if ( details !== undefined &&