Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add soak test for memory usage with external tilesets #1415

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
4 changes: 4 additions & 0 deletions Source/CesiumRuntime/Private/CesiumFlyToComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ void UCesiumFlyToComponent::InterruptFlight() {
OnFlightInterrupted.Broadcast();
}

bool UCesiumFlyToComponent::IsFlightInProgress() {
return this->_flightInProgress;
}

void UCesiumFlyToComponent::TickComponent(
float DeltaTime,
ELevelTick TickType,
Expand Down
46 changes: 6 additions & 40 deletions Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,15 @@

namespace Cesium {

struct LoadTestContext {
FString testName;
std::vector<TestPass> testPasses;

SceneGenerationContext creationContext;
SceneGenerationContext playContext;

float cameraFieldOfView = 90.0f;

ReportCallback reportStep;

void reset() {
testName.Reset();
testPasses.clear();
creationContext = playContext = SceneGenerationContext();
reportStep = nullptr;
}
};
inline void LoadTestContext::reset() {
testName.Reset();
testPasses.clear();
creationContext = playContext = SceneGenerationContext();
reportStep = nullptr;
}

LoadTestContext gLoadTestContext;

DEFINE_LATENT_AUTOMATION_COMMAND_THREE_PARAMETER(
TimeLoadingCommand,
FString,
loggingName,
SceneGenerationContext&,
playContext,
TestPass&,
pass);
bool TimeLoadingCommand::Update() {

if (!pass.testInProgress) {
Expand Down Expand Up @@ -106,10 +86,6 @@ bool TimeLoadingCommand::Update() {
return false;
}

DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(
LoadTestScreenshotCommand,
FString,
screenshotName);
bool LoadTestScreenshotCommand::Update() {
UE_LOG(
LogCesium,
Expand Down Expand Up @@ -139,10 +115,6 @@ void defaultReportStep(const std::vector<TestPass>& testPasses) {
UE_LOG(LogCesium, Display, TEXT("%s"), *reportStr);
}

DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(
TestCleanupCommand,
LoadTestContext&,
context);
bool TestCleanupCommand::Update() {
// Tag the fastest pass
if (context.testPasses.size() > 0) {
Expand All @@ -168,12 +140,6 @@ bool TestCleanupCommand::Update() {
return true;
}

DEFINE_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER(
InitForPlayWhenReady,
SceneGenerationContext&,
creationContext,
SceneGenerationContext&,
playContext);
bool InitForPlayWhenReady::Update() {
if (!GEditor || !GEditor->IsPlayingSessionInEditor())
return false;
Expand Down
54 changes: 39 additions & 15 deletions Source/CesiumRuntime/Private/Tests/CesiumLoadTestCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,26 @@
#include <variant>

#include "CesiumSceneGeneration.h"
#include "CesiumTestPass.h"
#include "Tests/AutomationCommon.h"

namespace Cesium {

struct TestPass {
typedef std::variant<int, float> TestingParameter;
typedef std::function<void(SceneGenerationContext&, TestingParameter)>
PassCallback;
typedef std::function<void(const std::vector<TestPass>&)> ReportCallback;

FString name;
PassCallback setupStep;
PassCallback verifyStep;
TestingParameter optionalParameter;
struct LoadTestContext {
FString testName;
std::vector<TestPass> testPasses;

bool testInProgress = false;
double startMark = 0;
double endMark = 0;
double elapsedTime = 0;
SceneGenerationContext creationContext;
SceneGenerationContext playContext;

bool isFastest = false;
};
float cameraFieldOfView = 90.0f;

typedef std::function<void(const std::vector<TestPass>&)> ReportCallback;
ReportCallback reportStep;

void reset();
};

bool RunLoadTest(
const FString& testName,
Expand All @@ -39,6 +37,32 @@ bool RunLoadTest(
int viewportHeight,
ReportCallback optionalReportStep = nullptr);

DEFINE_LATENT_AUTOMATION_COMMAND_THREE_PARAMETER(
TimeLoadingCommand,
FString,
loggingName,
SceneGenerationContext&,
playContext,
TestPass&,
pass);

DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(
LoadTestScreenshotCommand,
FString,
screenshotName);

DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(
TestCleanupCommand,
LoadTestContext&,
context);

DEFINE_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER(
InitForPlayWhenReady,
SceneGenerationContext&,
creationContext,
SceneGenerationContext&,
playContext);

}; // namespace Cesium

#endif
3 changes: 3 additions & 0 deletions Source/CesiumRuntime/Private/Tests/CesiumSceneGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
#include "LevelEditorViewport.h"

#include "Cesium3DTileset.h"
#include "CesiumAsync/ICacheDatabase.h"
#include "CesiumGeoreference.h"
#include "CesiumLoadTestCore.h"
#include "CesiumRuntime.h"
#include "CesiumSunSky.h"
#include "GlobeAwareDefaultPawn.h"

Expand Down
33 changes: 33 additions & 0 deletions Source/CesiumRuntime/Private/Tests/CesiumTestPass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once

#if WITH_EDITOR

#include <functional>
#include <variant>

#include "CesiumSceneGeneration.h"
#include "Tests/AutomationCommon.h"

namespace Cesium {

struct TestPass {
typedef std::variant<int, float> TestingParameter;
typedef std::function<void(SceneGenerationContext&, TestingParameter)>
PassCallback;

FString name;
PassCallback setupStep;
PassCallback verifyStep;
TestingParameter optionalParameter;

bool testInProgress = false;
double startMark = 0;
double endMark = 0;
double elapsedTime = 0;

bool isFastest = false;
};

} // namespace Cesium

#endif
Loading
Loading