tp: move parser_types into importers/common
Allows trace_sorter to be split from storage_minimal
Change-Id: Ie71124531a85ddc579c259459b1b300a8cf3adc0
diff --git a/Android.bp b/Android.bp
index 7ca2afa..e0f1ead 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1972,7 +1972,8 @@
":perfetto_src_trace_processor_ftrace_descriptors",
":perfetto_src_trace_processor_importers_android_bugreport_android_bugreport",
":perfetto_src_trace_processor_importers_common_common",
- ":perfetto_src_trace_processor_importers_common_trace_parser",
+ ":perfetto_src_trace_processor_importers_common_parser_types",
+ ":perfetto_src_trace_processor_importers_common_trace_parser_hdr",
":perfetto_src_trace_processor_importers_fuchsia_fuchsia_record",
":perfetto_src_trace_processor_importers_importers_full",
":perfetto_src_trace_processor_importers_memory_tracker_graph_processor",
@@ -9166,13 +9167,19 @@
"src/trace_processor/importers/common/slice_tracker.cc",
"src/trace_processor/importers/common/slice_translation_table.cc",
"src/trace_processor/importers/common/system_info_tracker.cc",
+ "src/trace_processor/importers/common/trace_parser.cc",
"src/trace_processor/importers/common/track_tracker.cc",
],
}
-// GN: //src/trace_processor/importers/common:trace_parser
+// GN: //src/trace_processor/importers/common:parser_types
filegroup {
- name: "perfetto_src_trace_processor_importers_common_trace_parser",
+ name: "perfetto_src_trace_processor_importers_common_parser_types",
+}
+
+// GN: //src/trace_processor/importers/common:trace_parser_hdr
+filegroup {
+ name: "perfetto_src_trace_processor_importers_common_trace_parser_hdr",
}
// GN: //src/trace_processor/importers/common:unittests
@@ -9708,7 +9715,6 @@
name: "perfetto_src_trace_processor_storage_minimal",
srcs: [
"src/trace_processor/forwarding_trace_parser.cc",
- "src/trace_processor/importers/common/trace_parser.cc",
"src/trace_processor/importers/default_modules.cc",
"src/trace_processor/importers/ftrace/ftrace_module.cc",
"src/trace_processor/importers/json/json_utils.cc",
@@ -11217,7 +11223,8 @@
":perfetto_src_trace_processor_importers_android_bugreport_android_bugreport",
":perfetto_src_trace_processor_importers_android_bugreport_unittests",
":perfetto_src_trace_processor_importers_common_common",
- ":perfetto_src_trace_processor_importers_common_trace_parser",
+ ":perfetto_src_trace_processor_importers_common_parser_types",
+ ":perfetto_src_trace_processor_importers_common_trace_parser_hdr",
":perfetto_src_trace_processor_importers_common_unittests",
":perfetto_src_trace_processor_importers_fuchsia_fuchsia_record",
":perfetto_src_trace_processor_importers_importers_full",
@@ -11863,7 +11870,8 @@
":perfetto_src_trace_processor_ftrace_descriptors",
":perfetto_src_trace_processor_importers_android_bugreport_android_bugreport",
":perfetto_src_trace_processor_importers_common_common",
- ":perfetto_src_trace_processor_importers_common_trace_parser",
+ ":perfetto_src_trace_processor_importers_common_parser_types",
+ ":perfetto_src_trace_processor_importers_common_trace_parser_hdr",
":perfetto_src_trace_processor_importers_fuchsia_fuchsia_record",
":perfetto_src_trace_processor_importers_importers_full",
":perfetto_src_trace_processor_importers_memory_tracker_graph_processor",
@@ -12060,7 +12068,8 @@
":perfetto_src_trace_processor_ftrace_descriptors",
":perfetto_src_trace_processor_importers_android_bugreport_android_bugreport",
":perfetto_src_trace_processor_importers_common_common",
- ":perfetto_src_trace_processor_importers_common_trace_parser",
+ ":perfetto_src_trace_processor_importers_common_parser_types",
+ ":perfetto_src_trace_processor_importers_common_trace_parser_hdr",
":perfetto_src_trace_processor_importers_fuchsia_fuchsia_record",
":perfetto_src_trace_processor_importers_importers_full",
":perfetto_src_trace_processor_importers_memory_tracker_graph_processor",
diff --git a/BUILD b/BUILD
index ad66422..6c5757f 100644
--- a/BUILD
+++ b/BUILD
@@ -1128,14 +1128,23 @@
"src/trace_processor/importers/common/slice_translation_table.h",
"src/trace_processor/importers/common/system_info_tracker.cc",
"src/trace_processor/importers/common/system_info_tracker.h",
+ "src/trace_processor/importers/common/trace_parser.cc",
"src/trace_processor/importers/common/track_tracker.cc",
"src/trace_processor/importers/common/track_tracker.h",
],
)
-# GN target: //src/trace_processor/importers/common:trace_parser
+# GN target: //src/trace_processor/importers/common:parser_types
perfetto_filegroup(
- name = "src_trace_processor_importers_common_trace_parser",
+ name = "src_trace_processor_importers_common_parser_types",
+ srcs = [
+ "src/trace_processor/importers/common/parser_types.h",
+ ],
+)
+
+# GN target: //src/trace_processor/importers/common:trace_parser_hdr
+perfetto_filegroup(
+ name = "src_trace_processor_importers_common_trace_parser_hdr",
srcs = [
"src/trace_processor/importers/common/trace_parser.h",
],
@@ -1939,7 +1948,6 @@
srcs = [
"src/trace_processor/forwarding_trace_parser.cc",
"src/trace_processor/forwarding_trace_parser.h",
- "src/trace_processor/importers/common/trace_parser.cc",
"src/trace_processor/importers/default_modules.cc",
"src/trace_processor/importers/default_modules.h",
"src/trace_processor/importers/ftrace/ftrace_module.cc",
@@ -1995,7 +2003,6 @@
"src/trace_processor/importers/proto/translation_table_module.cc",
"src/trace_processor/importers/proto/translation_table_module.h",
"src/trace_processor/importers/syscalls/syscall_tracker.h",
- "src/trace_processor/parser_types.h",
"src/trace_processor/trace_blob.cc",
"src/trace_processor/trace_processor_context.cc",
"src/trace_processor/trace_processor_storage.cc",
@@ -4389,7 +4396,8 @@
":src_trace_processor_ftrace_descriptors",
":src_trace_processor_importers_android_bugreport_android_bugreport",
":src_trace_processor_importers_common_common",
- ":src_trace_processor_importers_common_trace_parser",
+ ":src_trace_processor_importers_common_parser_types",
+ ":src_trace_processor_importers_common_trace_parser_hdr",
":src_trace_processor_importers_fuchsia_fuchsia_record",
":src_trace_processor_importers_importers_full",
":src_trace_processor_importers_memory_tracker_graph_processor",
@@ -4522,7 +4530,8 @@
":src_trace_processor_ftrace_descriptors",
":src_trace_processor_importers_android_bugreport_android_bugreport",
":src_trace_processor_importers_common_common",
- ":src_trace_processor_importers_common_trace_parser",
+ ":src_trace_processor_importers_common_parser_types",
+ ":src_trace_processor_importers_common_trace_parser_hdr",
":src_trace_processor_importers_fuchsia_fuchsia_record",
":src_trace_processor_importers_importers_full",
":src_trace_processor_importers_memory_tracker_graph_processor",
@@ -4714,7 +4723,8 @@
":src_trace_processor_ftrace_descriptors",
":src_trace_processor_importers_android_bugreport_android_bugreport",
":src_trace_processor_importers_common_common",
- ":src_trace_processor_importers_common_trace_parser",
+ ":src_trace_processor_importers_common_parser_types",
+ ":src_trace_processor_importers_common_trace_parser_hdr",
":src_trace_processor_importers_fuchsia_fuchsia_record",
":src_trace_processor_importers_importers_full",
":src_trace_processor_importers_memory_tracker_graph_processor",
diff --git a/src/trace_processor/BUILD.gn b/src/trace_processor/BUILD.gn
index 45d1255..54a1669 100644
--- a/src/trace_processor/BUILD.gn
+++ b/src/trace_processor/BUILD.gn
@@ -96,7 +96,6 @@
sources = [
"forwarding_trace_parser.cc",
"forwarding_trace_parser.h",
- "importers/common/trace_parser.cc",
"importers/default_modules.cc",
"importers/default_modules.h",
"importers/ftrace/ftrace_module.cc",
@@ -154,7 +153,6 @@
"importers/proto/translation_table_module.cc",
"importers/proto/translation_table_module.h",
"importers/syscalls/syscall_tracker.h",
- "parser_types.h",
"trace_blob.cc",
"trace_processor_context.cc",
"trace_processor_storage.cc",
@@ -175,6 +173,7 @@
"importers:gen_cc_statsd_atoms_descriptor",
"importers:gen_cc_track_event_descriptor",
"importers/common",
+ "importers/common:parser_types",
"importers/fuchsia:fuchsia_record",
"importers/memory_tracker:graph_processor",
"importers/proto:storage_minimal",
@@ -367,6 +366,7 @@
"importers:importers_full",
"importers/android_bugreport:unittests",
"importers/common",
+ "importers/common:parser_types",
"importers/common:unittests",
"importers/memory_tracker:graph_processor",
"importers/proto:storage_minimal",
diff --git a/src/trace_processor/importers/BUILD.gn b/src/trace_processor/importers/BUILD.gn
index d16cf68..f5de8ae 100644
--- a/src/trace_processor/importers/BUILD.gn
+++ b/src/trace_processor/importers/BUILD.gn
@@ -108,6 +108,7 @@
"../views",
"android_bugreport",
"common",
+ "common:parser_types",
"fuchsia:fuchsia_record",
"proto:storage_full",
"proto:storage_minimal",
diff --git a/src/trace_processor/importers/common/BUILD.gn b/src/trace_processor/importers/common/BUILD.gn
index 8cf4ce0..9c1b75e 100644
--- a/src/trace_processor/importers/common/BUILD.gn
+++ b/src/trace_processor/importers/common/BUILD.gn
@@ -39,16 +39,18 @@
"slice_translation_table.h",
"system_info_tracker.cc",
"system_info_tracker.h",
+ "trace_parser.cc",
"track_tracker.cc",
"track_tracker.h",
]
public_deps = [
- ":trace_parser",
+ ":trace_parser_hdr",
"../:gen_cc_config_descriptor",
"../../util:proto_to_args_parser",
"../../util:protozero_to_text",
]
deps = [
+ ":parser_types",
"../../../../gn:default_deps",
"../../../../include/perfetto/trace_processor",
"../../../../include/perfetto/trace_processor:basic_types",
@@ -58,14 +60,26 @@
"../../../base",
"../../storage",
"../../types",
+ "../fuchsia:fuchsia_record",
+ "../systrace:systrace_line",
]
}
-source_set("trace_parser") {
+source_set("trace_parser_hdr") {
sources = [ "trace_parser.h" ]
deps = [ "../../../../gn:default_deps" ]
}
+source_set("parser_types") {
+ sources = [ "parser_types.h" ]
+ deps = [
+ "../../../../gn:default_deps",
+ "../../../../include/perfetto/trace_processor:storage",
+ "../../containers",
+ "../proto:packet_sequence_state_generation_hdr",
+ ]
+}
+
source_set("unittests") {
sources = [
"args_translation_table_unittest.cc",
diff --git a/src/trace_processor/parser_types.h b/src/trace_processor/importers/common/parser_types.h
similarity index 84%
rename from src/trace_processor/parser_types.h
rename to src/trace_processor/importers/common/parser_types.h
index aa8e97d..9d5976c 100644
--- a/src/trace_processor/parser_types.h
+++ b/src/trace_processor/importers/common/parser_types.h
@@ -14,15 +14,14 @@
* limitations under the License.
*/
-#ifndef SRC_TRACE_PROCESSOR_PARSER_TYPES_H_
-#define SRC_TRACE_PROCESSOR_PARSER_TYPES_H_
+#ifndef SRC_TRACE_PROCESSOR_IMPORTERS_COMMON_PARSER_TYPES_H_
+#define SRC_TRACE_PROCESSOR_IMPORTERS_COMMON_PARSER_TYPES_H_
#include <stdint.h>
-#include "perfetto/ext/base/utils.h"
#include "perfetto/trace_processor/trace_blob_view.h"
-#include "src/trace_processor/importers/proto/packet_sequence_state.h"
-#include "src/trace_processor/storage/trace_storage.h"
+#include "src/trace_processor/containers/string_pool.h"
+#include "src/trace_processor/importers/proto/packet_sequence_state_generation.h"
namespace perfetto {
namespace trace_processor {
@@ -31,14 +30,14 @@
int64_t prev_state;
int32_t next_pid;
int32_t next_prio;
- StringId next_comm;
+ StringPool::Id next_comm;
};
struct InlineSchedWaking {
int32_t pid;
int32_t target_cpu;
int32_t prio;
- StringId comm;
+ StringPool::Id comm;
};
struct TracePacketData {
@@ -66,4 +65,4 @@
} // namespace trace_processor
} // namespace perfetto
-#endif // SRC_TRACE_PROCESSOR_PARSER_TYPES_H_
+#endif // SRC_TRACE_PROCESSOR_IMPORTERS_COMMON_PARSER_TYPES_H_
diff --git a/src/trace_processor/importers/common/trace_parser.cc b/src/trace_processor/importers/common/trace_parser.cc
index 09bd9b0..d075a57 100644
--- a/src/trace_processor/importers/common/trace_parser.cc
+++ b/src/trace_processor/importers/common/trace_parser.cc
@@ -16,9 +16,9 @@
#include "src/trace_processor/importers/common/trace_parser.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/fuchsia/fuchsia_record.h"
#include "src/trace_processor/importers/systrace/systrace_line.h"
-#include "src/trace_processor/parser_types.h"
namespace perfetto {
namespace trace_processor {
diff --git a/src/trace_processor/importers/ftrace/ftrace_module.cc b/src/trace_processor/importers/ftrace/ftrace_module.cc
index b97b5b0..f883614 100644
--- a/src/trace_processor/importers/ftrace/ftrace_module.cc
+++ b/src/trace_processor/importers/ftrace/ftrace_module.cc
@@ -16,7 +16,7 @@
#include "src/trace_processor/importers/ftrace/ftrace_module.h"
#include <cstdint>
-#include "src/trace_processor/parser_types.h"
+#include "src/trace_processor/importers/common/parser_types.h"
namespace perfetto {
namespace trace_processor {
diff --git a/src/trace_processor/importers/ftrace/ftrace_module.h b/src/trace_processor/importers/ftrace/ftrace_module.h
index 16e2f58..f9b289d 100644
--- a/src/trace_processor/importers/ftrace/ftrace_module.h
+++ b/src/trace_processor/importers/ftrace/ftrace_module.h
@@ -17,9 +17,9 @@
#ifndef SRC_TRACE_PROCESSOR_IMPORTERS_FTRACE_FTRACE_MODULE_H_
#define SRC_TRACE_PROCESSOR_IMPORTERS_FTRACE_FTRACE_MODULE_H_
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/common/trace_parser.h"
#include "src/trace_processor/importers/proto/proto_importer_module.h"
-#include "src/trace_processor/parser_types.h"
namespace perfetto {
namespace trace_processor {
diff --git a/src/trace_processor/importers/ftrace/ftrace_module_impl.h b/src/trace_processor/importers/ftrace/ftrace_module_impl.h
index 7414832..a341869 100644
--- a/src/trace_processor/importers/ftrace/ftrace_module_impl.h
+++ b/src/trace_processor/importers/ftrace/ftrace_module_impl.h
@@ -19,11 +19,11 @@
#include "perfetto/base/build_config.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/ftrace/ftrace_module.h"
#include "src/trace_processor/importers/ftrace/ftrace_parser.h"
#include "src/trace_processor/importers/ftrace/ftrace_tokenizer.h"
#include "src/trace_processor/importers/proto/proto_importer_module.h"
-#include "src/trace_processor/parser_types.h"
namespace perfetto {
namespace trace_processor {
diff --git a/src/trace_processor/importers/ftrace/ftrace_parser.cc b/src/trace_processor/importers/ftrace/ftrace_parser.cc
index e407411..b890d85 100644
--- a/src/trace_processor/importers/ftrace/ftrace_parser.cc
+++ b/src/trace_processor/importers/ftrace/ftrace_parser.cc
@@ -20,6 +20,7 @@
#include "perfetto/ext/base/string_writer.h"
#include "perfetto/protozero/proto_decoder.h"
#include "src/trace_processor/importers/common/args_tracker.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/common/process_tracker.h"
#include "src/trace_processor/importers/ftrace/binder_tracker.h"
#include "src/trace_processor/importers/ftrace/thread_state_tracker.h"
@@ -28,9 +29,9 @@
#include "src/trace_processor/importers/i2c/i2c_tracker.h"
#include "src/trace_processor/importers/proto/async_track_set_tracker.h"
#include "src/trace_processor/importers/proto/metadata_tracker.h"
+#include "src/trace_processor/importers/proto/packet_sequence_state.h"
#include "src/trace_processor/importers/syscalls/syscall_tracker.h"
#include "src/trace_processor/importers/systrace/systrace_parser.h"
-#include "src/trace_processor/parser_types.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/types/softirq_action.h"
diff --git a/src/trace_processor/importers/ftrace/ftrace_parser.h b/src/trace_processor/importers/ftrace/ftrace_parser.h
index b5809cb..fa5569a 100644
--- a/src/trace_processor/importers/ftrace/ftrace_parser.h
+++ b/src/trace_processor/importers/ftrace/ftrace_parser.h
@@ -19,6 +19,7 @@
#include "perfetto/trace_processor/status.h"
#include "src/trace_processor/importers/common/event_tracker.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/common/system_info_tracker.h"
#include "src/trace_processor/importers/common/trace_parser.h"
#include "src/trace_processor/importers/ftrace/drm_tracker.h"
@@ -26,7 +27,6 @@
#include "src/trace_processor/importers/ftrace/iostat_tracker.h"
#include "src/trace_processor/importers/ftrace/rss_stat_tracker.h"
#include "src/trace_processor/importers/ftrace/sched_event_tracker.h"
-#include "src/trace_processor/parser_types.h"
#include "src/trace_processor/types/trace_processor_context.h"
#include <unordered_set>
diff --git a/src/trace_processor/importers/ftrace/ftrace_tokenizer.cc b/src/trace_processor/importers/ftrace/ftrace_tokenizer.cc
index dd11cd4..8a376ab 100644
--- a/src/trace_processor/importers/ftrace/ftrace_tokenizer.cc
+++ b/src/trace_processor/importers/ftrace/ftrace_tokenizer.cc
@@ -19,6 +19,7 @@
#include "perfetto/base/logging.h"
#include "perfetto/protozero/proto_decoder.h"
#include "perfetto/protozero/proto_utils.h"
+#include "src/trace_processor/importers/proto/packet_sequence_state.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/trace_sorter.h"
@@ -153,7 +154,8 @@
ResolveTraceTime(context_, clock_id, int64_timestamp);
if (!timestamp)
return;
- context_->sorter->PushFtraceEvent(cpu, *timestamp, std::move(event), state);
+ context_->sorter->PushFtraceEvent(cpu, *timestamp, std::move(event),
+ state->current_generation());
}
PERFETTO_ALWAYS_INLINE
diff --git a/src/trace_processor/importers/proto/android_camera_event_module.cc b/src/trace_processor/importers/proto/android_camera_event_module.cc
index 8744534..8e80e50 100644
--- a/src/trace_processor/importers/proto/android_camera_event_module.cc
+++ b/src/trace_processor/importers/proto/android_camera_event_module.cc
@@ -13,15 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "src/trace_processor/importers/proto/android_camera_event_module.h"
#include "perfetto/ext/base/string_utils.h"
#include "protos/perfetto/trace/android/camera_event.pbzero.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/common/slice_tracker.h"
#include "src/trace_processor/importers/common/track_tracker.h"
#include "src/trace_processor/importers/proto/async_track_set_tracker.h"
-#include "src/trace_processor/parser_types.h"
+#include "src/trace_processor/importers/proto/packet_sequence_state.h"
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/trace_sorter.h"
@@ -51,8 +53,8 @@
protos::pbzero::AndroidCameraFrameEvent::Decoder(
decoder.android_camera_frame_event());
context_->sorter->PushTracePacket(
- android_camera_frame_event.request_processing_started_ns(), state,
- std::move(*packet));
+ android_camera_frame_event.request_processing_started_ns(),
+ state->current_generation(), std::move(*packet));
return ModuleResult::Handled();
}
diff --git a/src/trace_processor/importers/proto/android_camera_event_module.h b/src/trace_processor/importers/proto/android_camera_event_module.h
index 9916228..d6d70af 100644
--- a/src/trace_processor/importers/proto/android_camera_event_module.h
+++ b/src/trace_processor/importers/proto/android_camera_event_module.h
@@ -22,8 +22,8 @@
#include "perfetto/ext/base/optional.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/proto/proto_importer_module.h"
-#include "src/trace_processor/parser_types.h"
#include "src/trace_processor/tables/slice_tables.h"
#include "src/trace_processor/tables/track_tables.h"
#include "src/trace_processor/types/trace_processor_context.h"
diff --git a/src/trace_processor/importers/proto/android_probes_module.cc b/src/trace_processor/importers/proto/android_probes_module.cc
index f79ba1e..4371ba9 100644
--- a/src/trace_processor/importers/proto/android_probes_module.cc
+++ b/src/trace_processor/importers/proto/android_probes_module.cc
@@ -22,6 +22,7 @@
#include "src/trace_processor/importers/common/track_tracker.h"
#include "src/trace_processor/importers/proto/android_probes_parser.h"
#include "src/trace_processor/importers/proto/android_probes_tracker.h"
+#include "src/trace_processor/importers/proto/packet_sequence_state.h"
#include "src/trace_processor/trace_sorter.h"
#include "protos/perfetto/common/android_energy_consumer_descriptor.pbzero.h"
@@ -178,7 +179,7 @@
std::vector<uint8_t> vec = data_packet.SerializeAsArray();
TraceBlob blob = TraceBlob::CopyFrom(vec.data(), vec.size());
- context_->sorter->PushTracePacket(actual_ts, state,
+ context_->sorter->PushTracePacket(actual_ts, state->current_generation(),
TraceBlobView(std::move(blob)));
}
diff --git a/src/trace_processor/importers/proto/graphics_event_module.h b/src/trace_processor/importers/proto/graphics_event_module.h
index 7f9723c..324cec5 100644
--- a/src/trace_processor/importers/proto/graphics_event_module.h
+++ b/src/trace_processor/importers/proto/graphics_event_module.h
@@ -19,11 +19,11 @@
#include <cstdint>
#include "perfetto/base/build_config.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/proto/frame_timeline_event_parser.h"
#include "src/trace_processor/importers/proto/gpu_event_parser.h"
#include "src/trace_processor/importers/proto/graphics_frame_event_parser.h"
#include "src/trace_processor/importers/proto/proto_importer_module.h"
-#include "src/trace_processor/parser_types.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
diff --git a/src/trace_processor/importers/proto/heap_graph_module.cc b/src/trace_processor/importers/proto/heap_graph_module.cc
index ed5f2d1..0fe7506 100644
--- a/src/trace_processor/importers/proto/heap_graph_module.cc
+++ b/src/trace_processor/importers/proto/heap_graph_module.cc
@@ -16,15 +16,16 @@
#include "src/trace_processor/importers/proto/heap_graph_module.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/common/process_tracker.h"
#include "src/trace_processor/importers/proto/heap_graph_tracker.h"
#include "src/trace_processor/importers/proto/profiler_util.h"
-#include "src/trace_processor/parser_types.h"
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/types/trace_processor_context.h"
#include "protos/perfetto/trace/profiling/deobfuscation.pbzero.h"
#include "protos/perfetto/trace/profiling/heap_graph.pbzero.h"
+#include "protos/perfetto/trace/profiling/profile_common.pbzero.h"
namespace perfetto {
namespace trace_processor {
diff --git a/src/trace_processor/importers/proto/heap_graph_module.h b/src/trace_processor/importers/proto/heap_graph_module.h
index a098437..502eab1 100644
--- a/src/trace_processor/importers/proto/heap_graph_module.h
+++ b/src/trace_processor/importers/proto/heap_graph_module.h
@@ -18,9 +18,9 @@
#define SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_HEAP_GRAPH_MODULE_H_
#include "perfetto/base/build_config.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/proto/heap_graph_tracker.h"
#include "src/trace_processor/importers/proto/proto_importer_module.h"
-#include "src/trace_processor/parser_types.h"
#include "protos/perfetto/trace/profiling/deobfuscation.pbzero.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
diff --git a/src/trace_processor/importers/proto/memory_tracker_snapshot_module.cc b/src/trace_processor/importers/proto/memory_tracker_snapshot_module.cc
index 560363e..b428ab6 100644
--- a/src/trace_processor/importers/proto/memory_tracker_snapshot_module.cc
+++ b/src/trace_processor/importers/proto/memory_tracker_snapshot_module.cc
@@ -15,7 +15,7 @@
*/
#include "src/trace_processor/importers/proto/memory_tracker_snapshot_module.h"
-#include "src/trace_processor/parser_types.h"
+#include "src/trace_processor/importers/common/parser_types.h"
namespace perfetto {
namespace trace_processor {
diff --git a/src/trace_processor/importers/proto/metadata_module.cc b/src/trace_processor/importers/proto/metadata_module.cc
index 0d5062b..6468757 100644
--- a/src/trace_processor/importers/proto/metadata_module.cc
+++ b/src/trace_processor/importers/proto/metadata_module.cc
@@ -25,7 +25,7 @@
#include "protos/perfetto/trace/chrome/chrome_benchmark_metadata.pbzero.h"
#include "protos/perfetto/trace/chrome/chrome_metadata.pbzero.h"
#include "protos/perfetto/trace/trigger.pbzero.h"
-#include "src/trace_processor/parser_types.h"
+#include "src/trace_processor/importers/common/parser_types.h"
namespace perfetto {
namespace trace_processor {
diff --git a/src/trace_processor/importers/proto/profile_module.cc b/src/trace_processor/importers/proto/profile_module.cc
index 3c3e3e2..c1eef5d 100644
--- a/src/trace_processor/importers/proto/profile_module.cc
+++ b/src/trace_processor/importers/proto/profile_module.cc
@@ -138,8 +138,8 @@
sequence_state->IncrementAndGetTrackEventTimeNs(*timestamp_it * 1000);
}
- context_->sorter->PushTracePacket(packet_ts, sequence_state,
- std::move(*packet));
+ context_->sorter->PushTracePacket(
+ packet_ts, sequence_state->current_generation(), std::move(*packet));
return ModuleResult::Handled();
}
diff --git a/src/trace_processor/importers/proto/proto_trace_parser.cc b/src/trace_processor/importers/proto/proto_trace_parser.cc
index 07f6c23..e17c302 100644
--- a/src/trace_processor/importers/proto/proto_trace_parser.cc
+++ b/src/trace_processor/importers/proto/proto_trace_parser.cc
@@ -29,6 +29,7 @@
#include "src/trace_processor/importers/common/args_tracker.h"
#include "src/trace_processor/importers/common/event_tracker.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/common/process_tracker.h"
#include "src/trace_processor/importers/common/slice_tracker.h"
#include "src/trace_processor/importers/common/track_tracker.h"
@@ -36,7 +37,6 @@
#include "src/trace_processor/importers/ftrace/ftrace_module.h"
#include "src/trace_processor/importers/proto/metadata_tracker.h"
#include "src/trace_processor/importers/proto/packet_sequence_state.h"
-#include "src/trace_processor/parser_types.h"
#include "src/trace_processor/storage/metadata.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/types/trace_processor_context.h"
diff --git a/src/trace_processor/importers/proto/proto_trace_parser.h b/src/trace_processor/importers/proto/proto_trace_parser.h
index aaac271..f3c17ec 100644
--- a/src/trace_processor/importers/proto/proto_trace_parser.h
+++ b/src/trace_processor/importers/proto/proto_trace_parser.h
@@ -23,8 +23,8 @@
#include <memory>
#include "perfetto/protozero/field.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/common/trace_parser.h"
-#include "src/trace_processor/parser_types.h"
#include "src/trace_processor/storage/trace_storage.h"
namespace perfetto {
diff --git a/src/trace_processor/importers/proto/proto_trace_reader.cc b/src/trace_processor/importers/proto/proto_trace_reader.cc
index a6d6e22..e625ce1 100644
--- a/src/trace_processor/importers/proto/proto_trace_reader.cc
+++ b/src/trace_processor/importers/proto/proto_trace_reader.cc
@@ -224,7 +224,8 @@
// Use parent data and length because we want to parse this again
// later to get the exact type of the packet.
- context_->sorter->PushTracePacket(timestamp, state, std::move(packet));
+ context_->sorter->PushTracePacket(timestamp, state->current_generation(),
+ std::move(packet));
return util::OkStatus();
}
diff --git a/src/trace_processor/importers/proto/track_event_parser.h b/src/trace_processor/importers/proto/track_event_parser.h
index 52489d9..71340b3 100644
--- a/src/trace_processor/importers/proto/track_event_parser.h
+++ b/src/trace_processor/importers/proto/track_event_parser.h
@@ -23,11 +23,11 @@
#include "perfetto/base/build_config.h"
#include "perfetto/protozero/field.h"
#include "src/trace_processor/importers/common/args_tracker.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/common/slice_tracker.h"
#include "src/trace_processor/importers/common/trace_parser.h"
#include "src/trace_processor/importers/proto/active_chrome_processes_tracker.h"
#include "src/trace_processor/importers/proto/chrome_string_lookup.h"
-#include "src/trace_processor/parser_types.h"
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/util/proto_to_args_parser.h"
diff --git a/src/trace_processor/trace_sorter.cc b/src/trace_processor/trace_sorter.cc
index cbabf59..f50a722 100644
--- a/src/trace_processor/trace_sorter.cc
+++ b/src/trace_processor/trace_sorter.cc
@@ -18,8 +18,9 @@
#include <memory>
#include <utility>
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/fuchsia/fuchsia_record.h"
-#include "src/trace_processor/parser_types.h"
+#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/trace_sorter.h"
#include "src/trace_processor/trace_sorter_queue.h"
diff --git a/src/trace_processor/trace_sorter.h b/src/trace_processor/trace_sorter.h
index 6602614..5fae992 100644
--- a/src/trace_processor/trace_sorter.h
+++ b/src/trace_processor/trace_sorter.h
@@ -26,11 +26,12 @@
#include "perfetto/ext/base/utils.h"
#include "perfetto/trace_processor/basic_types.h"
#include "perfetto/trace_processor/trace_blob_view.h"
+#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/common/trace_parser.h"
#include "src/trace_processor/importers/fuchsia/fuchsia_record.h"
#include "src/trace_processor/importers/systrace/systrace_line.h"
-#include "src/trace_processor/parser_types.h"
#include "src/trace_processor/trace_sorter_queue.h"
+#include "src/trace_processor/types/trace_processor_context.h"
namespace perfetto {
namespace trace_processor {
@@ -52,10 +53,6 @@
class VariadicQueue;
} // namespace trace_sorter_internal
-class PacketSequenceState;
-class FuchsiaRecord;
-struct SystraceLine;
-
// This class takes care of sorting events parsed from the trace stream in
// arbitrary order and pushing them to the next pipeline stages (parsing) in
// order. In order to support streaming use-cases, sorting happens within a
@@ -118,9 +115,9 @@
~TraceSorter();
inline void PushTracePacket(int64_t timestamp,
- PacketSequenceState* state,
+ RefPtr<PacketSequenceStateGeneration> state,
TraceBlobView event) {
- TracePacketData tpd{std::move(event), state->current_generation()};
+ TracePacketData tpd{std::move(event), std::move(state)};
AppendNonFtraceEvent(timestamp, variadic_queue_.Append(std::move(tpd)),
EventType::kTracePacket);
}
@@ -154,10 +151,10 @@
inline void PushFtraceEvent(uint32_t cpu,
int64_t timestamp,
TraceBlobView event,
- PacketSequenceState* state) {
+ RefPtr<PacketSequenceStateGeneration> state) {
auto* queue = GetQueue(cpu + 1);
VariadicQueue::ValueReference ref = variadic_queue_.Append(
- TracePacketData{std::move(event), state->current_generation()});
+ TracePacketData{std::move(event), std::move(state)});
queue->Append(TimestampedDescriptor{
timestamp, Descriptor(ref, EventType::kFtraceEvent)});
UpdateGlobalTs(queue);
diff --git a/src/trace_processor/trace_sorter_internal.h b/src/trace_processor/trace_sorter_internal.h
index 895a0db..de3ccfe 100644
--- a/src/trace_processor/trace_sorter_internal.h
+++ b/src/trace_processor/trace_sorter_internal.h
@@ -18,8 +18,9 @@
#define SRC_TRACE_PROCESSOR_TRACE_SORTER_INTERNAL_H_
#include <deque>
+
#include "perfetto/base/logging.h"
-#include "src/trace_processor/parser_types.h"
+#include "src/trace_processor/importers/common/parser_types.h"
namespace perfetto {
namespace trace_processor {
diff --git a/src/trace_processor/trace_sorter_queue.h b/src/trace_processor/trace_sorter_queue.h
index 9fa334b..70926e0 100644
--- a/src/trace_processor/trace_sorter_queue.h
+++ b/src/trace_processor/trace_sorter_queue.h
@@ -19,7 +19,9 @@
#include <cstddef>
#include <deque>
+
#include "perfetto/base/logging.h"
+#include "perfetto/ext/base/small_vector.h"
#include "perfetto/ext/base/utils.h"
#include "src/trace_processor/trace_sorter_internal.h"
diff --git a/src/trace_processor/trace_sorter_unittest.cc b/src/trace_processor/trace_sorter_unittest.cc
index 9be6ca0..e689fa9 100644
--- a/src/trace_processor/trace_sorter_unittest.cc
+++ b/src/trace_processor/trace_sorter_unittest.cc
@@ -21,7 +21,8 @@
#include "perfetto/trace_processor/basic_types.h"
#include "perfetto/trace_processor/trace_blob.h"
-#include "src/trace_processor/parser_types.h"
+#include "src/trace_processor/importers/common/parser_types.h"
+#include "src/trace_processor/importers/proto/packet_sequence_state.h"
#include "src/trace_processor/trace_sorter.h"
#include "src/trace_processor/types/trace_processor_context.h"
#include "test/gtest_and_gmock.h"
@@ -100,7 +101,7 @@
TraceBlobView view = test_buffer_.slice_off(0, 1);
EXPECT_CALL(*parser_, MOCK_ParseFtracePacket(0, 1000, view.data(), 1));
context_.sorter->PushFtraceEvent(0 /*cpu*/, 1000 /*timestamp*/,
- std::move(view), &state);
+ std::move(view), state.current_generation());
context_.sorter->ExtractEventsForced();
}
@@ -108,7 +109,8 @@
PacketSequenceState state(&context_);
TraceBlobView view = test_buffer_.slice_off(0, 1);
EXPECT_CALL(*parser_, MOCK_ParseTracePacket(1000, view.data(), 1));
- context_.sorter->PushTracePacket(1000, &state, std::move(view));
+ context_.sorter->PushTracePacket(1000, state.current_generation(),
+ std::move(view));
context_.sorter->ExtractEventsForced();
}
@@ -127,11 +129,15 @@
EXPECT_CALL(*parser_, MOCK_ParseFtracePacket(2, 1200, view_4.data(), 4));
context_.sorter->PushFtraceEvent(2 /*cpu*/, 1200 /*timestamp*/,
- std::move(view_4), &state);
- context_.sorter->PushTracePacket(1001, &state, std::move(view_2));
- context_.sorter->PushTracePacket(1100, &state, std::move(view_3));
+ std::move(view_4),
+ state.current_generation());
+ context_.sorter->PushTracePacket(1001, state.current_generation(),
+ std::move(view_2));
+ context_.sorter->PushTracePacket(1100, state.current_generation(),
+ std::move(view_3));
context_.sorter->PushFtraceEvent(0 /*cpu*/, 1000 /*timestamp*/,
- std::move(view_1), &state);
+ std::move(view_1),
+ state.current_generation());
context_.sorter->ExtractEventsForced();
}
@@ -149,8 +155,10 @@
// Flush at the start of packet sequence to match behavior of the
// service.
context_.sorter->NotifyFlushEvent();
- context_.sorter->PushTracePacket(1200, &state, std::move(view_2));
- context_.sorter->PushTracePacket(1100, &state, std::move(view_1));
+ context_.sorter->PushTracePacket(1200, state.current_generation(),
+ std::move(view_2));
+ context_.sorter->PushTracePacket(1100, state.current_generation(),
+ std::move(view_1));
// No data should be exttracted at this point because we haven't
// seen two flushes yet.
@@ -163,8 +171,10 @@
context_.sorter->NotifyFlushEvent();
context_.sorter->NotifyFlushEvent();
- context_.sorter->PushTracePacket(1400, &state, std::move(view_4));
- context_.sorter->PushTracePacket(1300, &state, std::move(view_3));
+ context_.sorter->PushTracePacket(1400, state.current_generation(),
+ std::move(view_4));
+ context_.sorter->PushTracePacket(1300, state.current_generation(),
+ std::move(view_3));
// This ReadBuffer call should finally extract until the first OnReadBuffer
// call.
@@ -176,7 +186,8 @@
context_.sorter->NotifyReadBufferEvent();
context_.sorter->NotifyFlushEvent();
- context_.sorter->PushTracePacket(1500, &state, std::move(view_5));
+ context_.sorter->PushTracePacket(1500, state.current_generation(),
+ std::move(view_5));
// Nothing should be extracted as we haven't seen the second flush.
context_.sorter->NotifyReadBufferEvent();
@@ -209,8 +220,10 @@
context_.sorter->NotifyFlushEvent();
context_.sorter->NotifyFlushEvent();
- context_.sorter->PushTracePacket(1200, &state, std::move(view_2));
- context_.sorter->PushTracePacket(1100, &state, std::move(view_1));
+ context_.sorter->PushTracePacket(1200, state.current_generation(),
+ std::move(view_2));
+ context_.sorter->PushTracePacket(1100, state.current_generation(),
+ std::move(view_1));
context_.sorter->NotifyReadBufferEvent();
// Both of the packets should have been pushed through.
@@ -226,7 +239,8 @@
// Now, pass the third packet out of order.
context_.sorter->NotifyFlushEvent();
context_.sorter->NotifyFlushEvent();
- context_.sorter->PushTracePacket(1150, &state, std::move(view_3));
+ context_.sorter->PushTracePacket(1150, state.current_generation(),
+ std::move(view_3));
context_.sorter->NotifyReadBufferEvent();
// The third packet should still be pushed through.
@@ -243,7 +257,8 @@
// Push the fourth packet also out of order but after third.
context_.sorter->NotifyFlushEvent();
context_.sorter->NotifyFlushEvent();
- context_.sorter->PushTracePacket(1170, &state, std::move(view_4));
+ context_.sorter->PushTracePacket(1170, state.current_generation(),
+ std::move(view_4));
context_.sorter->NotifyReadBufferEvent();
// The fourt packet should still be pushed through.
@@ -288,7 +303,8 @@
for (int j = 0; j < num_cpus; j++) {
uint32_t cpu = static_cast<uint32_t>(rnd_engine() % 32);
expectations[ts].push_back(cpu);
- context_.sorter->PushFtraceEvent(cpu, ts, TraceBlobView(), &state);
+ context_.sorter->PushFtraceEvent(cpu, ts, TraceBlobView(),
+ state.current_generation());
}
}