Skip to content

Commit

Permalink
Merge "[metrics]: Add suspend and loss count to trace metadata." into…
Browse files Browse the repository at this point in the history
… main
  • Loading branch information
Lydia Tse authored and Gerrit Code Review committed Sep 13, 2024
2 parents c58a23d + 6c3e73d commit 56b5e6f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 6 deletions.
3 changes: 3 additions & 0 deletions protos/perfetto/metrics/metrics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ message TraceMetadata {
optional int64 sched_duration_ns = 10;
optional int64 tracing_started_ns = 11;
optional int64 android_sdk_version = 12;
optional int64 suspend_count = 13;
optional int64 data_loss_count = 14;
optional int64 error_count = 15;
}

// Stats counters for the trace.
Expand Down
3 changes: 3 additions & 0 deletions protos/perfetto/metrics/perfetto_merged_metrics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2968,6 +2968,9 @@ message TraceMetadata {
optional int64 sched_duration_ns = 10;
optional int64 tracing_started_ns = 11;
optional int64 android_sdk_version = 12;
optional int64 suspend_count = 13;
optional int64 data_loss_count = 14;
optional int64 error_count = 15;
}

// Stats counters for the trace.
Expand Down
10 changes: 7 additions & 3 deletions python/perfetto/trace_processor/metrics.descriptor
Original file line number Diff line number Diff line change
Expand Up @@ -1482,8 +1482,8 @@ threadName!
thread_id (RthreadId

process_id (R processId
Q
%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<protos/perfetto/metrics/android/wattson_in_time_period.proto<protos/perfetto/metrics/android/android_anomaly_metric.proto?protos/perfetto/metrics/android/wattson_tasks_attribution.proto"�
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<protos/perfetto/metrics/android/wattson_in_time_period.proto<protos/perfetto/metrics/android/android_anomaly_metric.proto?protos/perfetto/metrics/android/wattson_tasks_attribution.proto"�
TraceMetadata*
trace_duration_ns (RtraceDurationNs

Expand All @@ -1497,7 +1497,11 @@ trace_uuid ( R traceUuid:
sched_duration_ns
(RschedDurationNs,
tracing_started_ns (RtracingStartedNs.
android_sdk_version (RandroidSdkVersionJ"�
android_sdk_version (RandroidSdkVersion#
suspend_count (R suspendCount&
data_loss_count (RdataLossCount
error_count (R
errorCountJ"�
TraceAnalysisStats<
stat ( 2(.perfetto.protos.TraceAnalysisStats.StatRstat�
Stat
Expand Down
16 changes: 15 additions & 1 deletion src/trace_processor/metrics/sql/trace_metadata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
INCLUDE PERFETTO MODULE android.suspend;

DROP VIEW IF EXISTS trace_metadata_output;
CREATE PERFETTO VIEW trace_metadata_output AS
Expand Down Expand Up @@ -53,5 +54,18 @@ SELECT TraceMetadata(
'android_sdk_version', (
SELECT int_value FROM metadata
WHERE name = 'android_sdk_version'
),
'suspend_count', (
SELECT COUNT() FROM android_suspend_state WHERE power_state = 'suspended'
),
'data_loss_count', (
SELECT COUNT()
FROM stats
WHERE severity = 'data_loss' AND value > 0
),
'error_count', (
SELECT COUNT()
FROM stats
WHERE severity = 'error' AND value > 0
)
);
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ trace_metadata {
trace_uuid: "00000000-0000-0000-e77f-20a2204c2a49",
trace_size_bytes: 6365447
trace_config_pbtxt: "buffers {\n size_kb: 32768\n fill_policy: UNSPECIFIED\n}\ndata_sources {\n config {\n name: \"linux.ftrace\"\n target_buffer: 0\n trace_duration_ms: 0\n tracing_session_id: 0\n ftrace_config {\n ftrace_events: \"print\"\n ftrace_events: \"sched_switch\"\n ftrace_events: \"rss_stat\"\n ftrace_events: \"ion_heap_shrink\"\n ftrace_events: \"ion_heap_grow\"\n atrace_categories: \"am\"\n atrace_categories: \"dalvik\"\n buffer_size_kb: 0\n drain_period_ms: 0\n }\n chrome_config {\n trace_config: \"\"\n }\n inode_file_config {\n scan_interval_ms: 0\n scan_delay_ms: 0\n scan_batch_size: 0\n do_not_scan: false\n }\n process_stats_config {\n scan_all_processes_on_start: false\n record_thread_names: false\n proc_stats_poll_ms: 0\n }\n sys_stats_config {\n meminfo_period_ms: 0\n vmstat_period_ms: 0\n stat_period_ms: 0\n }\n heapprofd_config {\n sampling_interval_bytes: 0\n all: false\n continuous_dump_config {\n dump_phase_ms: 0\n dump_interval_ms: 0\n }\n }\n legacy_config: \"\"\n }\n}\ndata_sources {\n config {\n name: \"linux.process_stats\"\n target_buffer: 0\n trace_duration_ms: 0\n tracing_session_id: 0\n ftrace_config {\n buffer_size_kb: 0\n drain_period_ms: 0\n }\n chrome_config {\n trace_config: \"\"\n }\n inode_file_config {\n scan_interval_ms: 0\n scan_delay_ms: 0\n scan_batch_size: 0\n do_not_scan: false\n }\n process_stats_config {\n scan_all_processes_on_start: false\n record_thread_names: false\n proc_stats_poll_ms: 100\n }\n sys_stats_config {\n meminfo_period_ms: 0\n vmstat_period_ms: 0\n stat_period_ms: 0\n }\n heapprofd_config {\n sampling_interval_bytes: 0\n all: false\n continuous_dump_config {\n dump_phase_ms: 0\n dump_interval_ms: 0\n }\n }\n legacy_config: \"\"\n }\n}\ndata_sources {\n config {\n name: \"linux.sys_stats\"\n target_buffer: 0\n trace_duration_ms: 0\n tracing_session_id: 0\n ftrace_config {\n buffer_size_kb: 0\n drain_period_ms: 0\n }\n chrome_config {\n trace_config: \"\"\n }\n inode_file_config {\n scan_interval_ms: 0\n scan_delay_ms: 0\n scan_batch_size: 0\n do_not_scan: false\n }\n process_stats_config {\n scan_all_processes_on_start: false\n record_thread_names: false\n proc_stats_poll_ms: 0\n }\n sys_stats_config {\n meminfo_period_ms: 50\n meminfo_counters: MEMINFO_MEM_AVAILABLE\n meminfo_counters: MEMINFO_SWAP_CACHED\n meminfo_counters: MEMINFO_ACTIVE\n meminfo_counters: MEMINFO_INACTIVE\n vmstat_period_ms: 0\n stat_period_ms: 0\n }\n heapprofd_config {\n sampling_interval_bytes: 0\n all: false\n continuous_dump_config {\n dump_phase_ms: 0\n dump_interval_ms: 0\n }\n }\n legacy_config: \"\"\n }\n}\nduration_ms: 10000\nenable_extra_guardrails: false\nlockdown_mode: LOCKDOWN_UNCHANGED\nstatsd_metadata {\n triggering_alert_id: 0\n triggering_config_uid: 0\n triggering_config_id: 0\n}\nwrite_into_file: false\nfile_write_period_ms: 0\nmax_file_size_bytes: 0\nguardrail_overrides {\n max_upload_per_day_bytes: 0\n}\ndeferred_start: false",
sched_duration_ns: 9452761359
sched_duration_ns: 9452761359,
suspend_count: 0,
data_loss_count: 0,
error_count: 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"trace_uuid": "00000000-0000-0000-e77f-20a2204c2a49",
"trace_size_bytes": 6365447,
"trace_config_pbtxt": "buffers {\n size_kb: 32768\n fill_policy: UNSPECIFIED\n}\ndata_sources {\n config {\n name: \"linux.ftrace\"\n target_buffer: 0\n trace_duration_ms: 0\n tracing_session_id: 0\n ftrace_config {\n ftrace_events: \"print\"\n ftrace_events: \"sched_switch\"\n ftrace_events: \"rss_stat\"\n ftrace_events: \"ion_heap_shrink\"\n ftrace_events: \"ion_heap_grow\"\n atrace_categories: \"am\"\n atrace_categories: \"dalvik\"\n buffer_size_kb: 0\n drain_period_ms: 0\n }\n chrome_config {\n trace_config: \"\"\n }\n inode_file_config {\n scan_interval_ms: 0\n scan_delay_ms: 0\n scan_batch_size: 0\n do_not_scan: false\n }\n process_stats_config {\n scan_all_processes_on_start: false\n record_thread_names: false\n proc_stats_poll_ms: 0\n }\n sys_stats_config {\n meminfo_period_ms: 0\n vmstat_period_ms: 0\n stat_period_ms: 0\n }\n heapprofd_config {\n sampling_interval_bytes: 0\n all: false\n continuous_dump_config {\n dump_phase_ms: 0\n dump_interval_ms: 0\n }\n }\n legacy_config: \"\"\n }\n}\ndata_sources {\n config {\n name: \"linux.process_stats\"\n target_buffer: 0\n trace_duration_ms: 0\n tracing_session_id: 0\n ftrace_config {\n buffer_size_kb: 0\n drain_period_ms: 0\n }\n chrome_config {\n trace_config: \"\"\n }\n inode_file_config {\n scan_interval_ms: 0\n scan_delay_ms: 0\n scan_batch_size: 0\n do_not_scan: false\n }\n process_stats_config {\n scan_all_processes_on_start: false\n record_thread_names: false\n proc_stats_poll_ms: 100\n }\n sys_stats_config {\n meminfo_period_ms: 0\n vmstat_period_ms: 0\n stat_period_ms: 0\n }\n heapprofd_config {\n sampling_interval_bytes: 0\n all: false\n continuous_dump_config {\n dump_phase_ms: 0\n dump_interval_ms: 0\n }\n }\n legacy_config: \"\"\n }\n}\ndata_sources {\n config {\n name: \"linux.sys_stats\"\n target_buffer: 0\n trace_duration_ms: 0\n tracing_session_id: 0\n ftrace_config {\n buffer_size_kb: 0\n drain_period_ms: 0\n }\n chrome_config {\n trace_config: \"\"\n }\n inode_file_config {\n scan_interval_ms: 0\n scan_delay_ms: 0\n scan_batch_size: 0\n do_not_scan: false\n }\n process_stats_config {\n scan_all_processes_on_start: false\n record_thread_names: false\n proc_stats_poll_ms: 0\n }\n sys_stats_config {\n meminfo_period_ms: 50\n meminfo_counters: MEMINFO_MEM_AVAILABLE\n meminfo_counters: MEMINFO_SWAP_CACHED\n meminfo_counters: MEMINFO_ACTIVE\n meminfo_counters: MEMINFO_INACTIVE\n vmstat_period_ms: 0\n stat_period_ms: 0\n }\n heapprofd_config {\n sampling_interval_bytes: 0\n all: false\n continuous_dump_config {\n dump_phase_ms: 0\n dump_interval_ms: 0\n }\n }\n legacy_config: \"\"\n }\n}\nduration_ms: 10000\nenable_extra_guardrails: false\nlockdown_mode: LOCKDOWN_UNCHANGED\nstatsd_metadata {\n triggering_alert_id: 0\n triggering_config_uid: 0\n triggering_config_id: 0\n}\nwrite_into_file: false\nfile_write_period_ms: 0\nmax_file_size_bytes: 0\nguardrail_overrides {\n max_upload_per_day_bytes: 0\n}\ndeferred_start: false",
"sched_duration_ns": 9452761359
"sched_duration_ns": 9452761359,
"suspend_count": 0,
"data_loss_count": 0,
"error_count": 1
}
}

0 comments on commit 56b5e6f

Please sign in to comment.