// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.metrics";
option java_outer_classname = "SampledProfileProtos";
package metrics;
import "call_stack_profile.proto";
import "device_state.proto";
import "execution_context.proto";
import "perf_data.proto";
import "perf_stat.proto";
import "system_profile.proto";
// Protocol buffer for collected sample-based profiling data.
// Contains the parameters and data from a single profile collection event.
// Next tag: 23
message SampledProfile {
// Indicates the event that triggered this collection.
enum TriggerEvent {
UNKNOWN_TRIGGER_EVENT = 0;
// The profile was triggered by periodic sampling. Periodically sampled
// profiles are collected once per uniformly sized period interval. Within
// each interval, the sampled data is collected at a random time. For
// example, if the interval is 60 s, then data would be collected at a
// random point in each of the intervals [0, 60 s), [60 s, 120 s), etc.
PERIODIC_COLLECTION = 1;
// The profile was collected upon resume from suspend.
RESUME_FROM_SUSPEND = 2;
// The profile was collected upon restoring a previous session.
RESTORE_SESSION = 3;
// The profile was collected at process startup.
PROCESS_STARTUP = 4;
// The profile was collected after jank was detected while executing a task.
JANKY_TASK = 5;
// The profile was collected after a thread was determined to be hung.
THREAD_HUNG = 6;
// The heap profile was triggered by periodic sampling. The time intervals
// between trigger events conform to the Poisson process with certain mean
// interval between collections.
PERIODIC_HEAP_COLLECTION = 7;
}
optional TriggerEvent trigger_event = 1;
// The process in which the profile was collected.
optional Process process = 11;
// The thread in which the profile was collected.
optional Thread thread = 12;
// Map of Chrome PIDs running on the system when the profile was collected.
// Each Chrome PID is mapped to its process type.
// This field and the below thread_types field assume that the PID/TID
// information are collected in a short duration for a single session such
// that, the PID/TID reuse is highly unlikely.
// The information from these two fields is used to map chrome samples
// collected for a specific PID/TID to the corresponding process type and
// thread type.
map<uint32, Process> process_types = 13;
// A list of pids that belong to Lacros binaries, which are a subset of the
// keys of the process_types above.
repeated uint32 lacros_pids = 18 [packed = true];
// The version string of the Lacros Chrome browser running on a CrOS machine.
// It a 4-tuple of numbers separated by dots.
// Note: unlike the app_version in the system_profile.proto, this does not
// include any additional suffixes such as development build or bitness.
// This, and lacros_channel are only populated when lacros binaries are
// found in the running processes, i.e. when lacros_pids is not empty.
optional string lacros_version = 19;
// The channel of the Lacros Chrome browser running on a CrOS machine.
optional SystemProfileProto.Channel lacros_channel = 20;
// Map of Chrome TIDs running on the system when the profile was collected.
// Each Chrome TID is mapped to its thread type.
map<uint32, Thread> thread_types = 14;
// Fields 2-3: Time durations are given in ticks, and represent system uptime
// rather than wall time.
// Time after system boot when the collection took place, in milliseconds.
optional int64 ms_after_boot = 2;
// Time after last login when the collection took place, in milliseconds.
optional int64 ms_after_login = 3;
// The duration for which the machine was suspended prior to collecting the
// sampled profile. Only set when |trigger_event| is RESUME_FROM_SUSPEND.
optional int64 suspend_duration_ms = 5;
// Number of milliseconds after a resume that profile was collected. Only set
// when |trigger_event| is RESUME_FROM_SUSPEND.
optional int64 ms_after_resume = 6;
// Number of tabs restored during a session restore. Only set when
// |trigger_event| is RESTORE_SESSION.
optional int32 num_tabs_restored = 7;
// Number of milliseconds after a session restore that a profile was
// collected. Only set when |trigger_event| is RESTORE_SESSION.
optional int64 ms_after_restore = 8;
// Sampled profile data collected from Linux perf tool.
optional PerfDataProto perf_data = 4;
// Sampled profile data collected by periodic sampling of call stacks.
optional CallStackProfile call_stack_profile = 9;
// Perf counter data collected using "perf stat".
optional PerfStatProto perf_stat = 10;
// The maximum frequency in MHz reported for each logical CPU on the device.
// This is a repeated field, where entry 0 corresponds to core 0, entry 1 to
// core 1, and so on. The field is optional and populated only for metrics
// that can use the max frequency to compute a CPU utilization metric, e.g.
// when measuring CPU cycles.
repeated uint32 cpu_max_frequency_mhz = 15;
// The pressure-stall information that describes the state of CPU utilization
// of the system.
// The percent of the time that runnable processes are delayed because the CPU
// is unavailable, accumulated over 10 seconds.
optional float psi_cpu_last_10s_pct = 16;
// The percent of the time that runnable processes are delayed because the CPU
// is unavailable, accumulated over 60 seconds.
optional float psi_cpu_last_60s_pct = 17;
// The device thermal state when the profile was collected.
optional ThermalState thermal_state = 21;
// The operating system's advertised speed limit for CPUs in percent. Values
// below 100 indicate that the system is impairing processing power due to
// thermal management.
optional int32 cpu_speed_limit_percent = 22;
}