Files
UnrealEngineUWP/Engine/Source/Runtime/StorageServerClient/Private/StorageServerClientModule.cpp
david harvey 939dbf8352 New stats & debugging for Zen:
New Insights stats:
 - File I/O trace for storage server files (requires running with -trace=default,file)
 - Throughput counters, matching the on-screen display (requires -trace=default,counters)

Debug refactor:
 - Main stat processing moved to ticker
 - Startup stats processed by background thread

CVar changes:
 - On-screen graphs now toggled via zen.showgraphs
 - Added zen.showstats to toggle the on-screen throughput messages

#jira UE-221612
#rnx
#rb daniele.pieroni

[CL 35562191 by david harvey in ue5-main branch]
2024-08-15 10:01:59 -04:00

71 lines
2.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "StorageServerClientModule.h"
#include "Misc/CommandLine.h"
#include "Misc/Paths.h"
#include "StorageServerPlatformFile.h"
#if !UE_BUILD_SHIPPING
class FStorageServerClientModule : public IStorageServerClientModule
{
public:
FStorageServerClientModule() = default;
~FStorageServerClientModule() = default;
// ~Begin IModuleInterface
virtual void StartupModule() override;
virtual void ShutdownModule() override;
// ~End IModuleInterface
// ~Begin IPlatformFileModule
virtual IPlatformFile* GetPlatformFile() override;
// ~End IPlatformFileModule
// ~Begin IStorageServerClientModule
virtual IStorageServerPlatformFile* TryCreateCustomPlatformFile(FStringView StoreDirectory, IPlatformFile* Inner) override;
// ~End IStorageServerClientModule
IPlatformFile* CachedDefaultPlatformFileInstance = nullptr;
};
void FStorageServerClientModule::StartupModule()
{
}
void FStorageServerClientModule::ShutdownModule()
{
}
IPlatformFile* FStorageServerClientModule::GetPlatformFile()
{
static TUniquePtr<IPlatformFile> DefaultPlatformFileInstance = MakeUnique<FStorageServerPlatformFile>();
if (!CachedDefaultPlatformFileInstance)
{
CachedDefaultPlatformFileInstance = DefaultPlatformFileInstance.Get();
}
return DefaultPlatformFileInstance.Get();
}
IStorageServerPlatformFile* FStorageServerClientModule::TryCreateCustomPlatformFile(FStringView StoreDirectory, IPlatformFile* Inner)
{
TUniquePtr<FStorageServerPlatformFile> StorageServerPlatformFile = MakeUnique<FStorageServerPlatformFile>();
StorageServerPlatformFile->SetCustomProjectStorePath(StoreDirectory);
StorageServerPlatformFile->SetAllowPackageIo(false);
const TCHAR* CmdLine = FCommandLine::Get();
if (StorageServerPlatformFile->ShouldBeUsed(Inner, CmdLine) && StorageServerPlatformFile->Initialize(Inner, CmdLine))
{
if (FPaths::IsProjectFilePathSet())
{
StorageServerPlatformFile->InitializeAfterProjectFilePath();
}
return StorageServerPlatformFile.Release();
}
return nullptr;
}
IMPLEMENT_MODULE(FStorageServerClientModule, StorageServerClient)
#endif // !UE_BUILD_SHIPPING