• 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
21// Per-CPU stats for the ftrace data source gathered from the kernel from
22// /sys/kernel/debug/tracing/per_cpu/cpuX/stats.
23message FtraceCpuStats {
24  // CPU index.
25  optional uint64 cpu = 1;
26
27  // Number of entries still in the kernel buffer. Ideally this should be close
28  // to zero, as events are consumed regularly and moved into the userspace
29  // buffers (or file).
30  optional uint64 entries = 2;
31
32  // Number of events lost in kernel buffers due to overwriting of old events
33  // before userspace had a chance to drain them.
34  optional uint64 overrun = 3;
35
36  // This should always be zero. If not the buffer size is way too small or
37  // something went wrong with the tracer.
38  optional uint64 commit_overrun = 4;
39
40  // Bytes actually read (not overwritten).
41  optional uint64 bytes_read = 5;
42
43  // The timestamp for the oldest event still in the ring buffer.
44  optional double oldest_event_ts = 6;
45
46  // The current timestamp.
47  optional double now_ts = 7;
48
49  // If the kernel buffer has overwrite mode disabled, this will show the number
50  // of new events that were lost because the buffer was full. This is similar
51  // to |overrun| but only for the overwrite=false case.
52  optional uint64 dropped_events = 8;
53
54  // The number of events read.
55  optional uint64 read_events = 9;
56}
57
58// Ftrace stats for all CPUs.
59message FtraceStats {
60  enum Phase {
61    UNSPECIFIED = 0;
62    START_OF_TRACE = 1;
63    END_OF_TRACE = 2;
64  }
65
66  // Tells when stats were sampled. There should be one sample at the beginning
67  // of the trace and one sample at the end.
68  optional Phase phase = 1;
69
70  // Per-CPU stats (one entry for each CPU).
71  repeated FtraceCpuStats cpu_stats = 2;
72
73  // When FtraceConfig.symbolize_ksyms = true, this records the number of
74  // symbols parsed from /proc/kallsyms, whether they have been seen in the
75  // trace or not. It can be used to debug kptr_restrict or security-related
76  // errors.
77  // Note: this will be valid only when phase = END_OF_TRACE. The symbolizer is
78  // initialized. When START_OF_TRACE is emitted it is not ready yet.
79  optional uint32 kernel_symbols_parsed = 3;
80
81  // The memory used by the kernel symbolizer (KernelSymbolMap.size_bytes()).
82  optional uint32 kernel_symbols_mem_kb = 4;
83}
84