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; 19 20package perfetto.protos; 21 22import "perfetto/common/sys_stats_counters.proto"; 23 24// When editing this file run ./tools/gen_tracing_cpp_headers_from_protos.py 25// to reflect changes in the corresponding C++ headers. 26 27// This file defines the configuration for the Linux /proc poller data source, 28// which injects counters in the trace. 29// Counters that are needed in the trace must be explicitly listed in the 30// *_counters fields. This is to avoid spamming the trace with all counters 31// at all times. 32// The sampling rate is configurable. All polling rates (*_period_ms) need 33// to be integer multiples of each other. 34// OK: [10ms, 10ms, 10ms], [10ms, 20ms, 10ms], [10ms, 20ms, 60ms] 35// Not OK: [10ms, 10ms, 11ms], [10ms, 15ms, 20ms] 36message SysStatsConfig { 37 // Polls /proc/meminfo every X ms, if non-zero. 38 // This is required to be > 10ms to avoid excessive CPU usage. 39 // Cost: 0.3 ms [read] + 0.07 ms [parse + trace injection] 40 optional uint32 meminfo_period_ms = 1; 41 42 // Only the counters specified below are reported. 43 repeated MeminfoCounters meminfo_counters = 2; 44 45 // Polls /proc/vmstat every X ms, if non-zero. 46 // This is required to be > 10ms to avoid excessive CPU usage. 47 // Cost: 0.2 ms [read] + 0.3 ms [parse + trace injection] 48 optional uint32 vmstat_period_ms = 3; 49 repeated VmstatCounters vmstat_counters = 4; 50 51 // Pols /proc/stat every X ms, if non-zero. 52 // This is required to be > 10ms to avoid excessive CPU usage. 53 // Cost: 4.1 ms [read] + 1.9 ms [parse + trace injection] 54 optional uint32 stat_period_ms = 5; 55 enum StatCounters { 56 STAT_UNSPECIFIED = 0; 57 STAT_CPU_TIMES = 1; 58 STAT_IRQ_COUNTS = 2; 59 STAT_SOFTIRQ_COUNTS = 3; 60 STAT_FORK_COUNT = 4; 61 } 62 repeated StatCounters stat_counters = 6; 63} 64