1/* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18package perfetto.protos; 19 20// Per-process periodically sampled stats. These samples are wrapped in a 21// dedicated message (as opposite to be fields in process_tree.proto) because 22// they are dumped at a different rate than cmdline and thread list. 23// Note: not all of these stats will be present in every ProcessStats message 24// and sometimes processes may be missing . This is because counters are 25// cached to reduce emission of counters which do not change. 26message ProcessStats { 27 // Per-thread periodically sampled stats. 28 // Note: not all of these stats will be present in every message. See the note 29 // for ProcessStats. 30 message Thread { 31 optional int32 tid = 1; 32 33 // Pairs of frequency (represented as a (1-based) index to CpuInfo 34 // frequencies) and time at that frequency (represented as a number of 35 // ticks, see SystemInfo for the HZ (ticks / second) value to convert this 36 // to time). Frequencies with zero ticks are never uploaded. Read from 37 // /proc/tid/time_in_state. 38 repeated uint32 cpu_freq_indices = 2; 39 repeated uint64 cpu_freq_ticks = 3; 40 // Whether all frequencies with non-zero ticks are present in 41 // `cpu_freq_indices`. This marker is used to detect packets that describe 42 // time_in_state exhaustively. 43 optional bool cpu_freq_full = 4; 44 } 45 46 message Process { 47 optional int32 pid = 1; 48 49 // See /proc/[pid]/status in `man 5 proc` for a description of these fields. 50 optional uint64 vm_size_kb = 2; 51 optional uint64 vm_rss_kb = 3; 52 optional uint64 rss_anon_kb = 4; 53 optional uint64 rss_file_kb = 5; 54 optional uint64 rss_shmem_kb = 6; 55 optional uint64 vm_swap_kb = 7; 56 optional uint64 vm_locked_kb = 8; 57 optional uint64 vm_hwm_kb = 9; 58 // When adding a new field remember to update kProcMemCounterSize in 59 // the trace processor. 60 61 optional int64 oom_score_adj = 10; 62 63 repeated Thread threads = 11; 64 65 // The peak resident set size is resettable in newer Posix kernels. 66 // This field specifies if reset is supported and if the writer had reset 67 // the peaks after each process stats recording. 68 optional bool is_peak_rss_resettable = 12; 69 70 // Private, shared and swap footprint of the process as measured by 71 // Chrome. To know more about these metrics refer to: 72 // https://docs.google.com/document/d/1_WmgE1F5WUrhwkPqJis3dWyOiUmQKvpXp5cd4w86TvA 73 optional uint32 chrome_private_footprint_kb = 13; 74 optional uint32 chrome_peak_resident_set_kb = 14; 75 } 76 repeated Process processes = 1; 77 78 // The time at which we finish collecting this batch of samples; 79 // the top-level packet timestamp is the time at which 80 // we begin collection. 81 // TODO(dancol): analysis might be improved by 82 // time-bracketing each sample as well as the whole 83 // ProcessStats, but doing that is probably gated on 84 // a vdso for CLOCK_BOOTTIME. 85 optional uint64 collection_end_timestamp = 2; 86} 87