xref: /aosp_15_r20/external/cronet/third_party/metrics_proto/sampled_profile.proto (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1// Copyright 2014 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5syntax = "proto2";
6
7option optimize_for = LITE_RUNTIME;
8option java_package = "org.chromium.components.metrics";
9
10option java_outer_classname = "SampledProfileProtos";
11
12package metrics;
13
14import "call_stack_profile.proto";
15import "device_state.proto";
16import "execution_context.proto";
17import "perf_data.proto";
18import "perf_stat.proto";
19import "system_profile.proto";
20
21// Protocol buffer for collected sample-based profiling data.
22// Contains the parameters and data from a single profile collection event.
23
24// Next tag: 23
25message SampledProfile {
26  // Indicates the event that triggered this collection.
27  enum TriggerEvent {
28    UNKNOWN_TRIGGER_EVENT = 0;
29
30    // The profile was triggered by periodic sampling.  Periodically sampled
31    // profiles are collected once per uniformly sized period interval.  Within
32    // each interval, the sampled data is collected at a random time.  For
33    // example, if the interval is 60 s, then data would be collected at a
34    // random point in each of the intervals [0, 60 s), [60 s, 120 s), etc.
35    PERIODIC_COLLECTION = 1;
36
37    // The profile was collected upon resume from suspend.
38    RESUME_FROM_SUSPEND = 2;
39
40    // The profile was collected upon restoring a previous session.
41    RESTORE_SESSION = 3;
42
43    // The profile was collected at process startup.
44    PROCESS_STARTUP = 4;
45
46    // The profile was collected after jank was detected while executing a task.
47    JANKY_TASK = 5;
48
49    // The profile was collected after a thread was determined to be hung.
50    THREAD_HUNG = 6;
51
52    // The heap profile was triggered by periodic sampling. The time intervals
53    // between trigger events conform to the Poisson process with certain mean
54    // interval between collections.
55    PERIODIC_HEAP_COLLECTION = 7;
56  }
57  optional TriggerEvent trigger_event = 1;
58
59  // The process in which the profile was collected.
60  optional Process process = 11;
61
62  // The thread in which the profile was collected.
63  optional Thread thread = 12;
64
65  // Map of Chrome PIDs running on the system when the profile was collected.
66  // Each Chrome PID is mapped to its process type.
67  // This field and the below thread_types field assume that the PID/TID
68  // information are collected in a short duration for a single session such
69  // that, the PID/TID reuse is highly unlikely.
70  // The information from these two fields is used to map chrome samples
71  // collected for a specific PID/TID to the corresponding process type and
72  // thread type.
73  map<uint32, Process> process_types = 13;
74
75  // A list of pids that belong to Lacros binaries, which are a subset of the
76  // keys of the process_types above.
77  repeated uint32 lacros_pids = 18 [packed = true];
78
79  // The version string of the Lacros Chrome browser running on a CrOS machine.
80  // It a 4-tuple of numbers separated by dots.
81  // Note: unlike the app_version in the system_profile.proto, this does not
82  // include any additional suffixes such as development build or bitness.
83  // This, and lacros_channel are only populated when lacros binaries are
84  // found in the running processes, i.e. when lacros_pids is not empty.
85  optional string lacros_version = 19;
86
87  // The channel of the Lacros Chrome browser running on a CrOS machine.
88  optional SystemProfileProto.Channel lacros_channel = 20;
89
90  // Map of Chrome TIDs running on the system when the profile was collected.
91  // Each Chrome TID is mapped to its thread type.
92  map<uint32, Thread> thread_types = 14;
93
94  // Fields 2-3: Time durations are given in ticks, and represent system uptime
95  // rather than wall time.
96
97  // Time after system boot when the collection took place, in milliseconds.
98  optional int64 ms_after_boot = 2;
99
100  // Time after last login when the collection took place, in milliseconds.
101  optional int64 ms_after_login = 3;
102
103  // The duration for which the machine was suspended prior to collecting the
104  // sampled profile. Only set when |trigger_event| is RESUME_FROM_SUSPEND.
105  optional int64 suspend_duration_ms = 5;
106
107  // Number of milliseconds after a resume that profile was collected. Only set
108  // when |trigger_event| is RESUME_FROM_SUSPEND.
109  optional int64 ms_after_resume = 6;
110
111  // Number of tabs restored during a session restore. Only set when
112  // |trigger_event| is RESTORE_SESSION.
113  optional int32 num_tabs_restored = 7;
114
115  // Number of milliseconds after a session restore that a profile was
116  // collected. Only set when |trigger_event| is RESTORE_SESSION.
117  optional int64 ms_after_restore = 8;
118
119  // Sampled profile data collected from Linux perf tool.
120  optional PerfDataProto perf_data = 4;
121
122  // Sampled profile data collected by periodic sampling of call stacks.
123  optional CallStackProfile call_stack_profile = 9;
124
125  // Perf counter data collected using "perf stat".
126  optional PerfStatProto perf_stat = 10;
127
128  // The maximum frequency in MHz reported for each logical CPU on the device.
129  // This is a repeated field, where entry 0 corresponds to core 0, entry 1 to
130  // core 1, and so on. The field is optional and populated only for metrics
131  // that can use the max frequency to compute a CPU utilization metric, e.g.
132  // when measuring CPU cycles.
133  repeated uint32 cpu_max_frequency_mhz = 15;
134
135  // The pressure-stall information that describes the state of CPU utilization
136  // of the system.
137  // The percent of the time that runnable processes are delayed because the CPU
138  // is unavailable, accumulated over 10 seconds.
139  optional float psi_cpu_last_10s_pct = 16;
140
141  // The percent of the time that runnable processes are delayed because the CPU
142  // is unavailable, accumulated over 60 seconds.
143  optional float psi_cpu_last_60s_pct = 17;
144
145  // The device thermal state when the profile was collected.
146  optional ThermalState thermal_state = 21;
147
148  // The operating system's advertised speed limit for CPUs in percent. Values
149  // below 100 indicate that the system is impairing processing power due to
150  // thermal management.
151  optional int32 cpu_speed_limit_percent = 22;
152}
153