// Copyright Epic Games, Inc. All Rights Reserved. #include "FieldNotificationTraceAnalyzer.h" #include "FieldNotificationTraceProvider.h" #include "HAL/LowLevelMemTracker.h" #include "Serialization/MemoryReader.h" #include "TraceServices/Model/AnalysisSession.h" #include "TraceServices/Utils.h" namespace UE::FieldNotification { FTraceAnalyzer::FTraceAnalyzer(TraceServices::IAnalysisSession& InSession, FTraceProvider& InProvider) : Session(InSession) , Provider(InProvider) { } void FTraceAnalyzer::OnAnalysisBegin(const FOnAnalysisContext& Context) { auto& Builder = Context.InterfaceBuilder; Builder.RouteEvent(RouteId_ObjectBegin, "FieldNotification", "ObjectBegin"); Builder.RouteEvent(RouteId_ObjectEnd, "FieldNotification", "ObjectEnd"); Builder.RouteEvent(RouteId_FieldValueChanged, "FieldNotification", "FieldValueChanged"); Builder.RouteEvent(RouteId_StringId, "FieldNotification", "StringId"); } bool FTraceAnalyzer::OnEvent(uint16 RouteId, EStyle Style, const FOnEventContext& Context) { LLM_SCOPE_BYNAME(TEXT("Insights/FTraceAnalyzer")); TraceServices::FAnalysisSessionEditScope _(Session); const auto& EventData = Context.EventData; switch (RouteId) { case RouteId_ObjectBegin: { uint64 Cycle = EventData.GetValue("Cycle"); uint64 ObjectId = EventData.GetValue("ObjectId"); Provider.AppendObjectBegin(ObjectId, Context.EventTime.AsSeconds(Cycle)); break; } case RouteId_ObjectEnd: { uint64 Cycle = EventData.GetValue("Cycle"); uint64 ObjectId = EventData.GetValue("ObjectId"); Provider.AppendObjectEnd(ObjectId, Context.EventTime.AsSeconds(Cycle)); break; } case RouteId_FieldValueChanged: { uint64 Cycle = EventData.GetValue("Cycle"); double RecordingTime = EventData.GetValue("RecordingTime"); uint64 Id = EventData.GetValue("ObjectId"); uint32 FieldNotifyId = EventData.GetValue("FieldNotifyId"); Provider.AppendFieldValueChanged(Id, Context.EventTime.AsSeconds(Cycle), RecordingTime, FieldNotifyId); break; } case RouteId_StringId: { uint32 Id = EventData.GetValue("Id"); FStringView Value; EventData.GetString("Value", Value); Provider.AppendFieldNotify(Id, FName(Value)); break; } } return true; } } //namespace