Merge "traced_perf: re-enable linux build + add x86 regs handling"
diff --git a/gn/perfetto_unittests.gni b/gn/perfetto_unittests.gni
index ca956bc..84467e6 100644
--- a/gn/perfetto_unittests.gni
+++ b/gn/perfetto_unittests.gni
@@ -21,9 +21,12 @@
"src/protozero:unittests",
"src/tracing/core:unittests",
"src/profiling:unittests",
- "src/tracing/test:tracing_integration_test",
]
+if (enable_perfetto_ipc) {
+ perfetto_unittests_targets += [ "src/tracing/test:tracing_integration_test" ]
+}
+
if (enable_perfetto_tools && current_toolchain == host_toolchain) {
perfetto_unittests_targets += [ "tools/ftrace_proto_gen:unittests" ]
}
diff --git a/src/trace_processor/stack_profile_tracker.cc b/src/trace_processor/stack_profile_tracker.cc
index e9185e0..10138f3 100644
--- a/src/trace_processor/stack_profile_tracker.cc
+++ b/src/trace_processor/stack_profile_tracker.cc
@@ -185,6 +185,9 @@
SourceCallstackId id,
const SourceCallstack& frame_ids,
const InternLookup* intern_lookup) {
+ if (frame_ids.size() == 0)
+ return base::nullopt;
+
// TODO(fmayer): This should be NULL.
base::Optional<CallsiteId> parent_id;
for (size_t depth = 0; depth < frame_ids.size(); ++depth) {
@@ -215,6 +218,7 @@
}
parent_id = self_id;
}
+ PERFETTO_DCHECK(parent_id); // The loop ran at least once.
callstack_ids_.emplace(id, *parent_id);
return parent_id;
}
diff --git a/src/tracing/BUILD.gn b/src/tracing/BUILD.gn
index 1a36879..c93d5a5 100644
--- a/src/tracing/BUILD.gn
+++ b/src/tracing/BUILD.gn
@@ -57,6 +57,7 @@
"../../protos/perfetto/config:cpp",
"../base",
"core",
+ "core:service",
]
public_deps = [
"../../gn:default_deps",
diff --git a/test/trace_processor/index b/test/trace_processor/index
index afd8064..60711e9 100644
--- a/test/trace_processor/index
+++ b/test/trace_processor/index
@@ -156,6 +156,8 @@
../data/system-server-heap-graph.pftrace heap_graph_flamegraph.sql heap_graph_flamegraph_system-server-heap-graph.out
../data/system-server-native-profile heap_profile_flamegraph.sql heap_profile_flamegraph_system-server-native-profile.out
+stack_profile_tracker_empty_callstack.textproto stack_profile_tracker_empty_callstack.sql stack_profile_tracker_empty_callstack.out
+
# TrackEvent tests.
track_event_same_tids.textproto process_tracking.sql track_event_same_tids_threads.out
track_event_same_tids.textproto track_event_slices.sql track_event_same_tids_slices.out
diff --git a/test/trace_processor/stack_profile_tracker_empty_callstack.out b/test/trace_processor/stack_profile_tracker_empty_callstack.out
new file mode 100644
index 0000000..eb69505
--- /dev/null
+++ b/test/trace_processor/stack_profile_tracker_empty_callstack.out
@@ -0,0 +1,2 @@
+"count"
+0
diff --git a/test/trace_processor/stack_profile_tracker_empty_callstack.sql b/test/trace_processor/stack_profile_tracker_empty_callstack.sql
new file mode 100644
index 0000000..c61df0d
--- /dev/null
+++ b/test/trace_processor/stack_profile_tracker_empty_callstack.sql
@@ -0,0 +1 @@
+select count(1) as count from heap_profile_allocation;
diff --git a/test/trace_processor/stack_profile_tracker_empty_callstack.textproto b/test/trace_processor/stack_profile_tracker_empty_callstack.textproto
new file mode 100644
index 0000000..c0b6dfe
--- /dev/null
+++ b/test/trace_processor/stack_profile_tracker_empty_callstack.textproto
@@ -0,0 +1,45 @@
+packet {
+ clock_snapshot {
+ clocks: {
+ clock_id: 6 # BOOTTIME
+ timestamp: 0
+ }
+ clocks: {
+ clock_id: 4 # MONOTONIC_COARSE
+ timestamp: 0
+ }
+ }
+}
+
+packet {
+ previous_packet_dropped: true
+ incremental_state_cleared: true
+ trusted_packet_sequence_id: 1
+ timestamp: 0
+ interned_data {
+ callstacks {
+ iid: 1
+ }
+ }
+}
+
+packet {
+ trusted_packet_sequence_id: 1
+ timestamp: 0
+ profile_packet {
+ index: 0
+ continued: false
+ process_dumps {
+ samples {
+ callstack_id: 1
+ self_allocated: 1
+ alloc_count: 1
+ }
+ samples {
+ callstack_id: 1
+ self_allocated: 1
+ alloc_count: 1
+ }
+ }
+ }
+}