Merge "tp: don't log updated clocksnapshot if the clock is not changing"
diff --git a/src/trace_processor/importers/proto/packet_sequence_state.h b/src/trace_processor/importers/proto/packet_sequence_state.h
index c0a5fde..d6e3e08 100644
--- a/src/trace_processor/importers/proto/packet_sequence_state.h
+++ b/src/trace_processor/importers/proto/packet_sequence_state.h
@@ -157,6 +157,8 @@
template <uint32_t FieldId, typename MessageType>
typename MessageType::Decoder* LookupInternedMessage(uint64_t iid);
+ template <uint32_t FieldId>
+ InternedMessageView* GetInternedMessageView(uint64_t iid);
// Returns |nullptr| if no defaults were set.
InternedMessageView* GetTracePacketDefaultsView() {
if (!trace_packet_defaults_)
@@ -352,23 +354,32 @@
SequenceStackProfileTracker sequence_stack_profile_tracker_;
};
-template <uint32_t FieldId, typename MessageType>
-typename MessageType::Decoder*
-PacketSequenceStateGeneration::LookupInternedMessage(uint64_t iid) {
+template <uint32_t FieldId>
+InternedMessageView* PacketSequenceStateGeneration::GetInternedMessageView(
+ uint64_t iid) {
auto field_it = interned_data_.find(FieldId);
if (field_it != interned_data_.end()) {
auto* message_map = &field_it->second;
auto it = message_map->find(iid);
if (it != message_map->end()) {
- return it->second.GetOrCreateDecoder<MessageType>();
+ return &it->second;
}
}
state_->context()->storage->IncrementStats(
stats::interned_data_tokenizer_errors);
- base::ignore_result(generation_index_);
return nullptr;
}
+template <uint32_t FieldId, typename MessageType>
+typename MessageType::Decoder*
+PacketSequenceStateGeneration::LookupInternedMessage(uint64_t iid) {
+ auto* interned_message_view = GetInternedMessageView<FieldId>(iid);
+ if (!interned_message_view)
+ return nullptr;
+
+ return interned_message_view->template GetOrCreateDecoder<MessageType>();
+}
+
} // namespace trace_processor
} // namespace perfetto
diff --git a/src/trace_processor/importers/proto/profile_packet_utils.h b/src/trace_processor/importers/proto/profile_packet_utils.h
index 731eb35..eaa561e 100644
--- a/src/trace_processor/importers/proto/profile_packet_utils.h
+++ b/src/trace_processor/importers/proto/profile_packet_utils.h
@@ -174,12 +174,14 @@
base::Optional<SequenceStackProfileTracker::SourceCallstack> GetCallstack(
SequenceStackProfileTracker::SourceCallstackId iid) const override {
- auto* decoder = seq_state_->LookupInternedMessage<
- protos::pbzero::InternedData::kCallstacksFieldNumber,
- protos::pbzero::Callstack>(iid);
- if (!decoder)
+ auto* interned_message_view = seq_state_->GetInternedMessageView<
+ protos::pbzero::InternedData::kCallstacksFieldNumber>(iid);
+ if (!interned_message_view)
return base::nullopt;
- return ProfilePacketUtils::MakeSourceCallstack(*decoder);
+ protos::pbzero::Callstack::Decoder decoder(
+ interned_message_view->message().data(),
+ interned_message_view->message().length());
+ return ProfilePacketUtils::MakeSourceCallstack(std::move(decoder));
}
private: