diff --git a/Gem/Code/Source/NetSoakTestSystemComponent.cpp b/Gem/Code/Source/NetSoakTestSystemComponent.cpp index a896dbd..c8fd06b 100644 --- a/Gem/Code/Source/NetSoakTestSystemComponent.cpp +++ b/Gem/Code/Source/NetSoakTestSystemComponent.cpp @@ -100,6 +100,7 @@ namespace NetSoakTest AZ_CVAR(uint16_t, soak_port, 33450, nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "The port that this soak test will bind to for game traffic"); AZ_CVAR(ProtocolType, soak_protocol, ProtocolType::Udp, nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "Soak test protocol"); AZ_CVAR(SoakMode, soak_mode, SoakMode::Loopback, nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "Soak test mode"); + AZ_CVAR(AZ::TimeMs, soak_runtime, AZ::TimeMs(0), nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "How long to run the soak test for before dumping stats"); void NetSoakTestSystemComponent::Reflect(AZ::ReflectContext* context) { @@ -173,7 +174,16 @@ namespace NetSoakTest void NetSoakTestSystemComponent::OnTick(float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) { - [[maybe_unused]] AZ::TimeMs elapsedMs = aznumeric_cast(aznumeric_cast(deltaTime / 1000.0f)); + AZ::TimeMs elapsedMs = aznumeric_cast(aznumeric_cast(deltaTime / 1000.0f)); + + m_totalElapsedMs += elapsedMs; + if (soak_runtime != AZ::TimeMs(0) && m_totalElapsedMs > soak_runtime) + { + const AZ::CVarFixedString dumpSoakStatsStrings = "DumpSoakStats"; + const auto console = AZ::Interface::Get(); + console->PerformCommand(dumpSoakStatsStrings.c_str()); + exit(0); + } NetSoakTestPackets::Small packet; diff --git a/Gem/Code/Source/NetSoakTestSystemComponent.h b/Gem/Code/Source/NetSoakTestSystemComponent.h index 3b59c4b..fd7c5aa 100644 --- a/Gem/Code/Source/NetSoakTestSystemComponent.h +++ b/Gem/Code/Source/NetSoakTestSystemComponent.h @@ -74,5 +74,7 @@ namespace NetSoakTest private: AzNetworking::INetworkInterface* m_networkInterface = nullptr; AzNetworking::INetworkInterface* m_loopbackInterface = nullptr; + + AZ::TimeMs m_totalElapsedMs = AZ::TimeMs(0); }; } diff --git a/Scripts/build/Jenkins/Jenkinsfile b/Scripts/build/Jenkins/Jenkinsfile index d76f091..7a0319d 100644 --- a/Scripts/build/Jenkins/Jenkinsfile +++ b/Scripts/build/Jenkins/Jenkinsfile @@ -377,6 +377,15 @@ def Build(Map pipelineConfig, String platform, String type, String workspace) { command += " -u ${pipelineConfig.BUILD_ENTRY_POINT} --platform ${platform} --type ${type}" dir("${workspace}/${ENGINE_REPOSITORY_NAME}") { PlatformSh(command, "Running ${platform} ${type}") + + // Only launch NetSoakTest on the appropriate platforms + if (platform == 'Windows' && type != 'validation') { + // Launch the project, which automatically starts the tests + launch_command = "NetSoakTest.ServerLauncher.exe --soak_runtime=1800000 --soak_mode=loopback --rhi=null" + dir("${workspace}/${ENGINE_REPOSITORY_NAME}") { + PlatformSh("build/windows/bin/${type}/${launch_command}", "Running NetSoakTest project") + } + } } } }