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