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