1/*
2 * Copyright (C) 2017 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
19import "protos/perfetto/trace/ftrace/ftrace_event.proto";
20
21package perfetto.protos;
22
23// The result of tracing one or more ftrace data pages from a single per-cpu
24// kernel ring buffer. If collating multiple pages' worth of events, all of
25// them come from contiguous pages, with no kernel data loss in between.
26message FtraceEventBundle {
27  optional uint32 cpu = 1;
28  repeated FtraceEvent event = 2;
29  // Set to true if there was data loss between the last time we've read from
30  // the corresponding per-cpu kernel buffer, and the earliest event recorded
31  // in this bundle.
32  optional bool lost_events = 3;
33
34  // Optionally-enabled compact encoding of a batch of scheduling events. Only
35  // a subset of events & their fields is recorded.
36  // All fields (except comms) are stored in a structure-of-arrays form, one
37  // entry in each repeated field per event.
38  message CompactSched {
39    // Interned table of unique strings for this bundle.
40    repeated string intern_table = 5;
41
42    // Delta-encoded timestamps across all sched_switch events within this
43    // bundle. The first is absolute, each next one is relative to its
44    // predecessor.
45    repeated uint64 switch_timestamp = 1 [packed = true];
46    repeated int64 switch_prev_state = 2 [packed = true];
47    repeated int32 switch_next_pid = 3 [packed = true];
48    repeated int32 switch_next_prio = 4 [packed = true];
49    // One per event, index into |intern_table| corresponding to the
50    // next_comm field of the event.
51    repeated uint32 switch_next_comm_index = 6 [packed = true];
52
53    // Delta-encoded timestamps across all sched_waking events within this
54    // bundle. The first is absolute, each next one is relative to its
55    // predecessor.
56    repeated uint64 waking_timestamp = 7 [packed = true];
57    repeated int32 waking_pid = 8 [packed = true];
58    repeated int32 waking_target_cpu = 9 [packed = true];
59    repeated int32 waking_prio = 10 [packed = true];
60    // One per event, index into |intern_table| corresponding to the
61    // comm field of the event.
62    repeated uint32 waking_comm_index = 11 [packed = true];
63  }
64  optional CompactSched compact_sched = 4;
65}
66