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 58 optional TriggerEvent trigger_event = 1; 59 60 // The process in which the profile was collected. 61 optional Process process = 11; 62 63 // The thread in which the profile was collected. 64 optional Thread thread = 12; 65 66 // Map of Chrome PIDs running on the system when the profile was collected. 67 // Each Chrome PID is mapped to its process type. 68 // This field and the below thread_types field assume that the PID/TID 69 // information are collected in a short duration for a single session such 70 // that, the PID/TID reuse is highly unlikely. 71 // The information from these two fields is used to map chrome samples 72 // collected for a specific PID/TID to the corresponding process type and 73 // thread type. 74 map<uint32, Process> process_types = 13; 75 76 // A list of pids that belong to Lacros binaries, which are a subset of the 77 // keys of the process_types above. 78 repeated uint32 lacros_pids = 18 [packed = true]; 79 80 // The version string of the Lacros Chrome browser running on a CrOS machine. 81 // It a 4-tuple of numbers separated by dots. 82 // Note: unlike the app_version in the system_profile.proto, this does not 83 // include any additional suffixes such as development build or bitness. 84 // This, and lacros_channel are only populated when lacros binaries are 85 // found in the running processes, i.e. when lacros_pids is not empty. 86 optional string lacros_version = 19; 87 88 // The channel of the Lacros Chrome browser running on a CrOS machine. 89 optional SystemProfileProto.Channel lacros_channel = 20; 90 91 // Map of Chrome TIDs running on the system when the profile was collected. 92 // Each Chrome TID is mapped to its thread type. 93 map<uint32, Thread> thread_types = 14; 94 95 // Fields 2-3: Time durations are given in ticks, and represent system uptime 96 // rather than wall time. 97 98 // Time after system boot when the collection took place, in milliseconds. 99 optional int64 ms_after_boot = 2; 100 101 // Time after last login when the collection took place, in milliseconds. 102 optional int64 ms_after_login = 3; 103 104 // The duration for which the machine was suspended prior to collecting the 105 // sampled profile. Only set when |trigger_event| is RESUME_FROM_SUSPEND. 106 optional int64 suspend_duration_ms = 5; 107 108 // Number of milliseconds after a resume that profile was collected. Only set 109 // when |trigger_event| is RESUME_FROM_SUSPEND. 110 optional int64 ms_after_resume = 6; 111 112 // Number of tabs restored during a session restore. Only set when 113 // |trigger_event| is RESTORE_SESSION. 114 optional int32 num_tabs_restored = 7; 115 116 // Number of milliseconds after a session restore that a profile was 117 // collected. Only set when |trigger_event| is RESTORE_SESSION. 118 optional int64 ms_after_restore = 8; 119 120 // Sampled profile data collected from Linux perf tool. 121 optional PerfDataProto perf_data = 4; 122 123 // Sampled profile data collected by periodic sampling of call stacks. 124 optional CallStackProfile call_stack_profile = 9; 125 126 // Perf counter data collected using "perf stat". 127 optional PerfStatProto perf_stat = 10; 128 129 // The maximum frequency in MHz reported for each logical CPU on the device. 130 // This is a repeated field, where entry 0 corresponds to core 0, entry 1 to 131 // core 1, and so on. The field is optional and populated only for metrics 132 // that can use the max frequency to compute a CPU utilization metric, e.g. 133 // when measuring CPU cycles. 134 repeated uint32 cpu_max_frequency_mhz = 15; 135 136 // The pressure-stall information that describes the state of CPU utilization 137 // of the system. 138 // The percent of the time that runnable processes are delayed because the CPU 139 // is unavailable, accumulated over 10 seconds. 140 optional float psi_cpu_last_10s_pct = 16; 141 142 // The percent of the time that runnable processes are delayed because the CPU 143 // is unavailable, accumulated over 60 seconds. 144 optional float psi_cpu_last_60s_pct = 17; 145 146 // The device thermal state when the profile was collected. 147 optional ThermalState thermal_state = 21; 148 149 // The operating system's advertised speed limit for CPUs in percent. Values 150 // below 100 indicate that the system is impairing processing power due to 151 // thermal management. 152 optional int32 cpu_speed_limit_percent = 22; 153} 154