Files

65 lines
945 B
C++
Raw Permalink Normal View History

Trace: Create interfaces in TraceServices for external Analysis ### Features This change sets up new interface APIs and moves concrete APIs into those interfaces to allow for providers to be implemented external to TraceServices. These Provider interfaces are given to new construction APIs in ExternalAnalysis.h that construct the appropriate Analyzer with the specified Providers. This change creates a new and standalone Analyzer for Bookmarks spinning logic directly out of the MiscAnalyzer. This is necessary to prevent bookmark processing necessitating additional Providers that the client may not want to implement if they just want access to Bookmark data. SummarizeTraceCommandlet implements these provider interfaces and migrates it's state tracking implementation from raw event decoding to simply forwarding on the calls from the Provider interfaces. The internal SummarizeTraceCommandlet Analyzer API in the Commandlet are mostly left unchanged as a middleman between Trace and the Commandlet existed prior to this change. ### Implementation Since Providers can now implement multiple interfaces, we need to upcast them to the appropriate interface at registration time. This in turn requires moving the Provider memory model into IAnalysisSession to TSharedPtr/MakeShared to prevent double deletes at destruction time. ### Performance Opening a large trace in Insights yields this performance change: Pre: Analyzed in 8.29s at 122.8X speed. Post: Analyzed in 8.36s at 121.8X speed. Commandlet runtime is comparable (I didn't measure, less sensitive than Insights), and memory pressure remains more or less steady in the low teens of gigabytes. ### Testing A/B testing and spot checking the data shows that nearly all data is either more correct or withing many-decimal-places rounding error. UnrealInsights and Editor builds without error in NoPCH, DisableUnity configurations ### Hashtags #rb ionut.matasaru #jira UE-120810 #preflight 62bc9d717f31fc8c31fd6d18 #robomerge EngineMerge [CL 20893535 by Francis Hurteau in ue5-main branch]
2022-06-30 09:17:47 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
#include "Trace/DataStream.h"
#include "GenericPlatform/GenericPlatformFile.h"
#include "HAL/PlatformFileManager.h"
namespace UE {
namespace Trace {
FFileDataStream::FFileDataStream()
: Handle(nullptr)
, Remaining(0)
{
}
FFileDataStream::~FFileDataStream()
{
}
bool FFileDataStream::Open(const TCHAR* Path)
{
Handle.Reset(FPlatformFileManager::Get().GetPlatformFile().OpenRead(Path));
if (Handle == nullptr)
{
return false;
}
Remaining = Handle->Size();
return true;
}
int32 FFileDataStream::Read(void* Data, uint32 Size)
{
if (Handle == nullptr)
{
return -1;
}
if (Remaining <= 0)
{
return 0;
}
if (Size > Remaining)
{
Size = static_cast<uint32>(Remaining);
}
Trace: Create interfaces in TraceServices for external Analysis ### Features This change sets up new interface APIs and moves concrete APIs into those interfaces to allow for providers to be implemented external to TraceServices. These Provider interfaces are given to new construction APIs in ExternalAnalysis.h that construct the appropriate Analyzer with the specified Providers. This change creates a new and standalone Analyzer for Bookmarks spinning logic directly out of the MiscAnalyzer. This is necessary to prevent bookmark processing necessitating additional Providers that the client may not want to implement if they just want access to Bookmark data. SummarizeTraceCommandlet implements these provider interfaces and migrates it's state tracking implementation from raw event decoding to simply forwarding on the calls from the Provider interfaces. The internal SummarizeTraceCommandlet Analyzer API in the Commandlet are mostly left unchanged as a middleman between Trace and the Commandlet existed prior to this change. ### Implementation Since Providers can now implement multiple interfaces, we need to upcast them to the appropriate interface at registration time. This in turn requires moving the Provider memory model into IAnalysisSession to TSharedPtr/MakeShared to prevent double deletes at destruction time. ### Performance Opening a large trace in Insights yields this performance change: Pre: Analyzed in 8.29s at 122.8X speed. Post: Analyzed in 8.36s at 121.8X speed. Commandlet runtime is comparable (I didn't measure, less sensitive than Insights), and memory pressure remains more or less steady in the low teens of gigabytes. ### Testing A/B testing and spot checking the data shows that nearly all data is either more correct or withing many-decimal-places rounding error. UnrealInsights and Editor builds without error in NoPCH, DisableUnity configurations ### Hashtags #rb ionut.matasaru #jira UE-120810 #preflight 62bc9d717f31fc8c31fd6d18 #robomerge EngineMerge [CL 20893535 by Francis Hurteau in ue5-main branch]
2022-06-30 09:17:47 -04:00
Remaining -= Size;
if (!Handle->Read((uint8*)Data, Size))
Trace: Create interfaces in TraceServices for external Analysis ### Features This change sets up new interface APIs and moves concrete APIs into those interfaces to allow for providers to be implemented external to TraceServices. These Provider interfaces are given to new construction APIs in ExternalAnalysis.h that construct the appropriate Analyzer with the specified Providers. This change creates a new and standalone Analyzer for Bookmarks spinning logic directly out of the MiscAnalyzer. This is necessary to prevent bookmark processing necessitating additional Providers that the client may not want to implement if they just want access to Bookmark data. SummarizeTraceCommandlet implements these provider interfaces and migrates it's state tracking implementation from raw event decoding to simply forwarding on the calls from the Provider interfaces. The internal SummarizeTraceCommandlet Analyzer API in the Commandlet are mostly left unchanged as a middleman between Trace and the Commandlet existed prior to this change. ### Implementation Since Providers can now implement multiple interfaces, we need to upcast them to the appropriate interface at registration time. This in turn requires moving the Provider memory model into IAnalysisSession to TSharedPtr/MakeShared to prevent double deletes at destruction time. ### Performance Opening a large trace in Insights yields this performance change: Pre: Analyzed in 8.29s at 122.8X speed. Post: Analyzed in 8.36s at 121.8X speed. Commandlet runtime is comparable (I didn't measure, less sensitive than Insights), and memory pressure remains more or less steady in the low teens of gigabytes. ### Testing A/B testing and spot checking the data shows that nearly all data is either more correct or withing many-decimal-places rounding error. UnrealInsights and Editor builds without error in NoPCH, DisableUnity configurations ### Hashtags #rb ionut.matasaru #jira UE-120810 #preflight 62bc9d717f31fc8c31fd6d18 #robomerge EngineMerge [CL 20893535 by Francis Hurteau in ue5-main branch]
2022-06-30 09:17:47 -04:00
{
Close();
return -1;
Trace: Create interfaces in TraceServices for external Analysis ### Features This change sets up new interface APIs and moves concrete APIs into those interfaces to allow for providers to be implemented external to TraceServices. These Provider interfaces are given to new construction APIs in ExternalAnalysis.h that construct the appropriate Analyzer with the specified Providers. This change creates a new and standalone Analyzer for Bookmarks spinning logic directly out of the MiscAnalyzer. This is necessary to prevent bookmark processing necessitating additional Providers that the client may not want to implement if they just want access to Bookmark data. SummarizeTraceCommandlet implements these provider interfaces and migrates it's state tracking implementation from raw event decoding to simply forwarding on the calls from the Provider interfaces. The internal SummarizeTraceCommandlet Analyzer API in the Commandlet are mostly left unchanged as a middleman between Trace and the Commandlet existed prior to this change. ### Implementation Since Providers can now implement multiple interfaces, we need to upcast them to the appropriate interface at registration time. This in turn requires moving the Provider memory model into IAnalysisSession to TSharedPtr/MakeShared to prevent double deletes at destruction time. ### Performance Opening a large trace in Insights yields this performance change: Pre: Analyzed in 8.29s at 122.8X speed. Post: Analyzed in 8.36s at 121.8X speed. Commandlet runtime is comparable (I didn't measure, less sensitive than Insights), and memory pressure remains more or less steady in the low teens of gigabytes. ### Testing A/B testing and spot checking the data shows that nearly all data is either more correct or withing many-decimal-places rounding error. UnrealInsights and Editor builds without error in NoPCH, DisableUnity configurations ### Hashtags #rb ionut.matasaru #jira UE-120810 #preflight 62bc9d717f31fc8c31fd6d18 #robomerge EngineMerge [CL 20893535 by Francis Hurteau in ue5-main branch]
2022-06-30 09:17:47 -04:00
}
return Size;
Trace: Create interfaces in TraceServices for external Analysis ### Features This change sets up new interface APIs and moves concrete APIs into those interfaces to allow for providers to be implemented external to TraceServices. These Provider interfaces are given to new construction APIs in ExternalAnalysis.h that construct the appropriate Analyzer with the specified Providers. This change creates a new and standalone Analyzer for Bookmarks spinning logic directly out of the MiscAnalyzer. This is necessary to prevent bookmark processing necessitating additional Providers that the client may not want to implement if they just want access to Bookmark data. SummarizeTraceCommandlet implements these provider interfaces and migrates it's state tracking implementation from raw event decoding to simply forwarding on the calls from the Provider interfaces. The internal SummarizeTraceCommandlet Analyzer API in the Commandlet are mostly left unchanged as a middleman between Trace and the Commandlet existed prior to this change. ### Implementation Since Providers can now implement multiple interfaces, we need to upcast them to the appropriate interface at registration time. This in turn requires moving the Provider memory model into IAnalysisSession to TSharedPtr/MakeShared to prevent double deletes at destruction time. ### Performance Opening a large trace in Insights yields this performance change: Pre: Analyzed in 8.29s at 122.8X speed. Post: Analyzed in 8.36s at 121.8X speed. Commandlet runtime is comparable (I didn't measure, less sensitive than Insights), and memory pressure remains more or less steady in the low teens of gigabytes. ### Testing A/B testing and spot checking the data shows that nearly all data is either more correct or withing many-decimal-places rounding error. UnrealInsights and Editor builds without error in NoPCH, DisableUnity configurations ### Hashtags #rb ionut.matasaru #jira UE-120810 #preflight 62bc9d717f31fc8c31fd6d18 #robomerge EngineMerge [CL 20893535 by Francis Hurteau in ue5-main branch]
2022-06-30 09:17:47 -04:00
}
void FFileDataStream::Close()
{
Handle.Reset();
}
} // namespace Trace
} // namespace UE