aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Savitski <rsavitski@google.com>2019-11-08 10:24:17 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-11-08 10:24:17 -0800
commit6f7736a2725ebfb3c275ba2867454ec7d086c7d6 (patch)
tree3d865817cbe9688439b220e68f12efafb48dfcbb
parent24fe6df06447a0031fa2241d164ec47af967b694 (diff)
parent423745a5427ff4b24c50b147ce959d6faaa68375 (diff)
downloadperfetto-6f7736a2725ebfb3c275ba2867454ec7d086c7d6.tar.gz
Merge "compact sched_waking: cfg/trace protos" am: 1de6bb1cd4
am: 423745a542 Change-Id: Id13324abbeffb4f770fb4c50fbcf553125b5db37
-rw-r--r--protos/perfetto/config/ftrace/ftrace_config.proto13
-rw-r--r--protos/perfetto/config/perfetto_config.proto13
-rw-r--r--protos/perfetto/trace/ftrace/ftrace_event_bundle.proto19
-rw-r--r--protos/perfetto/trace/perfetto_trace.proto32
-rw-r--r--src/perfetto_cmd/perfetto_config.descriptor.h2
-rw-r--r--src/trace_processor/importers/ftrace/ftrace_tokenizer.cc2
-rw-r--r--src/traced/probes/ftrace/compact_sched.cc4
-rw-r--r--src/traced/probes/ftrace/cpu_reader_unittest.cc4
-rw-r--r--tools/compact_reencode/main.cc2
9 files changed, 52 insertions, 39 deletions
diff --git a/protos/perfetto/config/ftrace/ftrace_config.proto b/protos/perfetto/config/ftrace/ftrace_config.proto
index 56dc0d012..3b1e6a248 100644
--- a/protos/perfetto/config/ftrace/ftrace_config.proto
+++ b/protos/perfetto/config/ftrace/ftrace_config.proto
@@ -27,16 +27,13 @@ message FtraceConfig {
optional uint32 buffer_size_kb = 10;
optional uint32 drain_period_ms = 11;
- // Configuration for compact encoding of scheduler events. If enabled, this
- // records a small subset of fields of selected scheduling events, and
- // encodes them in a denser proto format than normal. This is useful due to
- // scheduling events being abundant in a typical trace, and dominating its
- // size via a combination of unnecessary data being retained, and proto
- // format overheads.
+ // Configuration for compact encoding of scheduler events. When enabled (and
+ // recording the relevant ftrace events), the most high-volume events are
+ // encoded in a denser format than normal.
// TODO(rsavitski): unstable, do not use.
message CompactSchedConfig {
- // If true, and sched_switch ftrace event is enabled, record those events
- // in the compact format.
+ // If true, and sched_switch or sched_waking ftrace events are enabled,
+ // record those events in the compact format.
optional bool enabled = 1;
}
optional CompactSchedConfig compact_sched = 12;
diff --git a/protos/perfetto/config/perfetto_config.proto b/protos/perfetto/config/perfetto_config.proto
index 49e5a6688..670e584f7 100644
--- a/protos/perfetto/config/perfetto_config.proto
+++ b/protos/perfetto/config/perfetto_config.proto
@@ -631,16 +631,13 @@ message FtraceConfig {
optional uint32 buffer_size_kb = 10;
optional uint32 drain_period_ms = 11;
- // Configuration for compact encoding of scheduler events. If enabled, this
- // records a small subset of fields of selected scheduling events, and
- // encodes them in a denser proto format than normal. This is useful due to
- // scheduling events being abundant in a typical trace, and dominating its
- // size via a combination of unnecessary data being retained, and proto
- // format overheads.
+ // Configuration for compact encoding of scheduler events. When enabled (and
+ // recording the relevant ftrace events), the most high-volume events are
+ // encoded in a denser format than normal.
// TODO(rsavitski): unstable, do not use.
message CompactSchedConfig {
- // If true, and sched_switch ftrace event is enabled, record those events
- // in the compact format.
+ // If true, and sched_switch or sched_waking ftrace events are enabled,
+ // record those events in the compact format.
optional bool enabled = 1;
}
optional CompactSchedConfig compact_sched = 12;
diff --git a/protos/perfetto/trace/ftrace/ftrace_event_bundle.proto b/protos/perfetto/trace/ftrace/ftrace_event_bundle.proto
index e61377a48..a65191d36 100644
--- a/protos/perfetto/trace/ftrace/ftrace_event_bundle.proto
+++ b/protos/perfetto/trace/ftrace/ftrace_event_bundle.proto
@@ -38,6 +38,9 @@ message FtraceEventBundle {
// entry in each repeated field per event.
// TODO(rsavitski): unstable, do not use.
message CompactSched {
+ // Interned table of unique strings for this bundle.
+ repeated string intern_table = 5;
+
// Delta-encoded timestamps across all sched_switch events within this
// bundle. The first is absolute, each next one is relative to its
// predecessor.
@@ -45,12 +48,20 @@ message FtraceEventBundle {
repeated int64 switch_prev_state = 2 [packed = true];
repeated int32 switch_next_pid = 3 [packed = true];
repeated int32 switch_next_prio = 4 [packed = true];
-
- // Interned table of unique comm strings for this bundle.
- repeated string switch_next_comm_table = 5;
- // One per event, index into |switch_next_comm_table| corresponding to the
+ // One per event, index into |intern_table| corresponding to the
// next_comm field of the event.
repeated uint32 switch_next_comm_index = 6 [packed = true];
+
+ // Delta-encoded timestamps across all sched_waking events within this
+ // bundle. The first is absolute, each next one is relative to its
+ // predecessor.
+ repeated uint64 waking_timestamp = 7 [packed = true];
+ repeated int32 waking_pid = 8 [packed = true];
+ repeated int32 waking_target_cpu = 9 [packed = true];
+ repeated int32 waking_prio = 10 [packed = true];
+ // One per event, index into |intern_table| corresponding to the
+ // comm field of the event.
+ repeated uint32 waking_comm_index = 11 [packed = true];
}
optional CompactSched compact_sched = 4;
}
diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto
index f59d18248..a9cc0ff96 100644
--- a/protos/perfetto/trace/perfetto_trace.proto
+++ b/protos/perfetto/trace/perfetto_trace.proto
@@ -2318,6 +2318,9 @@ message FtraceEventBundle {
// entry in each repeated field per event.
// TODO(rsavitski): unstable, do not use.
message CompactSched {
+ // Interned table of unique strings for this bundle.
+ repeated string intern_table = 5;
+
// Delta-encoded timestamps across all sched_switch events within this
// bundle. The first is absolute, each next one is relative to its
// predecessor.
@@ -2325,12 +2328,20 @@ message FtraceEventBundle {
repeated int64 switch_prev_state = 2 [packed = true];
repeated int32 switch_next_pid = 3 [packed = true];
repeated int32 switch_next_prio = 4 [packed = true];
-
- // Interned table of unique comm strings for this bundle.
- repeated string switch_next_comm_table = 5;
- // One per event, index into |switch_next_comm_table| corresponding to the
+ // One per event, index into |intern_table| corresponding to the
// next_comm field of the event.
repeated uint32 switch_next_comm_index = 6 [packed = true];
+
+ // Delta-encoded timestamps across all sched_waking events within this
+ // bundle. The first is absolute, each next one is relative to its
+ // predecessor.
+ repeated uint64 waking_timestamp = 7 [packed = true];
+ repeated int32 waking_pid = 8 [packed = true];
+ repeated int32 waking_target_cpu = 9 [packed = true];
+ repeated int32 waking_prio = 10 [packed = true];
+ // One per event, index into |intern_table| corresponding to the
+ // comm field of the event.
+ repeated uint32 waking_comm_index = 11 [packed = true];
}
optional CompactSched compact_sched = 4;
}
@@ -4457,16 +4468,13 @@ message FtraceConfig {
optional uint32 buffer_size_kb = 10;
optional uint32 drain_period_ms = 11;
- // Configuration for compact encoding of scheduler events. If enabled, this
- // records a small subset of fields of selected scheduling events, and
- // encodes them in a denser proto format than normal. This is useful due to
- // scheduling events being abundant in a typical trace, and dominating its
- // size via a combination of unnecessary data being retained, and proto
- // format overheads.
+ // Configuration for compact encoding of scheduler events. When enabled (and
+ // recording the relevant ftrace events), the most high-volume events are
+ // encoded in a denser format than normal.
// TODO(rsavitski): unstable, do not use.
message CompactSchedConfig {
- // If true, and sched_switch ftrace event is enabled, record those events
- // in the compact format.
+ // If true, and sched_switch or sched_waking ftrace events are enabled,
+ // record those events in the compact format.
optional bool enabled = 1;
}
optional CompactSchedConfig compact_sched = 12;
diff --git a/src/perfetto_cmd/perfetto_config.descriptor.h b/src/perfetto_cmd/perfetto_config.descriptor.h
index 666bac9ce..f480e88a7 100644
--- a/src/perfetto_cmd/perfetto_config.descriptor.h
+++ b/src/perfetto_cmd/perfetto_config.descriptor.h
@@ -12,7 +12,7 @@
// SHA1(tools/gen_binary_descriptors)
// 192b582ae52bb07b3d3ba66a94bcfd3127a5f42f
// SHA1(protos/perfetto/config/perfetto_config.proto)
-// 267f9d49ca0c50158496fd5dc90ab15480500724
+// 7e29ded10dd6cff450d72d81dbaba1f8ef65c64f
// This is the proto PerfettoConfig encoded as a ProtoFileDescriptor to allow
// for reflection without libprotobuf full/non-lite protos.
diff --git a/src/trace_processor/importers/ftrace/ftrace_tokenizer.cc b/src/trace_processor/importers/ftrace/ftrace_tokenizer.cc
index 8a183a715..10c6aaf21 100644
--- a/src/trace_processor/importers/ftrace/ftrace_tokenizer.cc
+++ b/src/trace_processor/importers/ftrace/ftrace_tokenizer.cc
@@ -73,7 +73,7 @@ void FtraceTokenizer::TokenizeFtraceCompactSched(uint32_t cpu,
// Build the interning table for next_comm fields.
std::vector<StringId> string_table;
string_table.reserve(512);
- for (auto it = compact.switch_next_comm_table(); it; it++) {
+ for (auto it = compact.intern_table(); it; it++) {
StringId value = context_->storage->InternString(*it);
string_table.push_back(value);
}
diff --git a/src/traced/probes/ftrace/compact_sched.cc b/src/traced/probes/ftrace/compact_sched.cc
index 6bc76195d..63b87ff43 100644
--- a/src/traced/probes/ftrace/compact_sched.cc
+++ b/src/traced/probes/ftrace/compact_sched.cc
@@ -169,8 +169,8 @@ void CompactSchedBundleState::WriteAndReset(
compact_out->set_switch_next_prio(switch_next_prio_);
for (size_t i = 0; i < interned_switch_comms_size_; i++) {
- compact_out->add_switch_next_comm_table(interned_switch_comms_[i].data(),
- interned_switch_comms_[i].size());
+ compact_out->add_intern_table(interned_switch_comms_[i].data(),
+ interned_switch_comms_[i].size());
}
compact_out->set_switch_next_comm_index(switch_next_comm_index_);
}
diff --git a/src/traced/probes/ftrace/cpu_reader_unittest.cc b/src/traced/probes/ftrace/cpu_reader_unittest.cc
index d008744b2..7f17c0751 100644
--- a/src/traced/probes/ftrace/cpu_reader_unittest.cc
+++ b/src/traced/probes/ftrace/cpu_reader_unittest.cc
@@ -861,7 +861,7 @@ TEST(CpuReaderTest, ParseSixSchedSwitchCompactFormat) {
EXPECT_EQ(6, compact_sched.switch_next_pid().size());
EXPECT_EQ(6, compact_sched.switch_next_prio().size());
// 4 unique interned next_comm strings:
- EXPECT_EQ(4, compact_sched.switch_next_comm_table().size());
+ EXPECT_EQ(4, compact_sched.intern_table().size());
EXPECT_EQ(6, compact_sched.switch_next_comm_index().size());
// First event exactly as expected (absolute timestamp):
@@ -870,7 +870,7 @@ TEST(CpuReaderTest, ParseSixSchedSwitchCompactFormat) {
EXPECT_EQ(1, compact_sched.switch_prev_state(0));
EXPECT_EQ(3733, compact_sched.switch_next_pid(0));
EXPECT_EQ(120, compact_sched.switch_next_prio(0));
- std::string next_comm = compact_sched.switch_next_comm_table(
+ std::string next_comm = compact_sched.intern_table(
static_cast<int>(compact_sched.switch_next_comm_index(0)));
EXPECT_EQ("sleep", next_comm);
}
diff --git a/tools/compact_reencode/main.cc b/tools/compact_reencode/main.cc
index d54db1c7d..982be0e87 100644
--- a/tools/compact_reencode/main.cc
+++ b/tools/compact_reencode/main.cc
@@ -113,7 +113,7 @@ void ReEncodeBundle(protos::pbzero::TracePacket* packet_out,
auto* compact_sched = bundle_out->set_compact_sched();
for (const auto& s : string_table)
- compact_sched->add_switch_next_comm_table(s.data(), s.size());
+ compact_sched->add_intern_table(s.data(), s.size());
compact_sched->set_switch_timestamp(switch_timestamp);
compact_sched->set_switch_next_comm_index(switch_next_comm_index);