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"; 18option optimize_for = LITE_RUNTIME; 19package perfetto.protos; 20 21import "perfetto/common/sys_stats_counters.proto"; 22 23// Various Linux system stat counters from /proc. 24// The fields in this message can be reported at different rates and with 25// different granularity. See sys_stats_config.proto. 26message SysStats { 27 // Counters from /proc/meminfo. Values are in KB. 28 message MeminfoValue { 29 optional MeminfoCounters key = 1; 30 optional uint64 value = 2; 31 }; 32 repeated MeminfoValue meminfo = 1; 33 34 // Counter from /proc/vmstat. Units are often pages, not KB. 35 message VmstatValue { 36 optional VmstatCounters key = 1; 37 optional uint64 value = 2; 38 }; 39 repeated VmstatValue vmstat = 2; 40 41 // Times in each mode, since boot. Unit: nanoseconds. 42 message CpuTimes { 43 optional uint32 cpu_id = 1; 44 optional uint64 user_ns = 2; // Time spent in user mode. 45 optional uint64 user_ice_ns = 3; // Time spent in user mode (low prio). 46 optional uint64 system_mode_ns = 4; // Time spent in system mode. 47 optional uint64 idle_ns = 5; // Time spent in the idle task. 48 optional uint64 io_wait_ns = 6; // Time spent waiting for I/O. 49 optional uint64 irq_ns = 7; // Time spent servicing interrupts. 50 optional uint64 softirq_ns = 8; // Time spent servicing softirqs. 51 } 52 repeated CpuTimes cpu_stat = 3; // One entry per cpu. 53 54 // Num processes forked since boot. 55 // Populated only if FORK_COUNT in config.stat_counters. 56 optional uint64 num_forks = 4; 57 58 message InterruptCount { 59 optional int32 irq = 1; 60 optional uint64 count = 2; 61 } 62 63 // Number of interrupts, broken by IRQ number. 64 // Populated only if IRQ_COUNTS in config.stat_counters. 65 optional uint64 num_irq_total = 5; // Total num of irqs serviced since boot. 66 repeated InterruptCount num_irq = 6; 67 68 // Number of softirqs, broken by softirq number. 69 // Populated only if SOFTIRQ_COUNTS in config.stat_counters. 70 optional uint64 num_softirq_total = 7; // Total num of softirqs since boot. 71 repeated InterruptCount num_softirq = 8; // Per-softirq count. 72 73 // The time at which we finish collecting this set of samples; 74 // the top-level packet timestamp is the time at which 75 // we begin collection. 76 optional uint64 collection_end_timestamp = 9; 77} 78