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

Added ability for NetSoakTest project to dump stats after a time dela… #15

Draft
wants to merge 10 commits into
base: development
Choose a base branch
from
12 changes: 11 additions & 1 deletion Gem/Code/Source/NetSoakTestSystemComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -173,7 +174,16 @@ namespace NetSoakTest

void NetSoakTestSystemComponent::OnTick(float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
{
[[maybe_unused]] AZ::TimeMs elapsedMs = aznumeric_cast<AZ::TimeMs>(aznumeric_cast<int64_t>(deltaTime / 1000.0f));
AZ::TimeMs elapsedMs = aznumeric_cast<AZ::TimeMs>(aznumeric_cast<int64_t>(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<AZ::IConsole>::Get();
console->PerformCommand(dumpSoakStatsStrings.c_str());
exit(0);
}

NetSoakTestPackets::Small packet;

Expand Down
2 changes: 2 additions & 0 deletions Gem/Code/Source/NetSoakTestSystemComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,7 @@ namespace NetSoakTest
private:
AzNetworking::INetworkInterface* m_networkInterface = nullptr;
AzNetworking::INetworkInterface* m_loopbackInterface = nullptr;

AZ::TimeMs m_totalElapsedMs = AZ::TimeMs(0);
};
}
9 changes: 9 additions & 0 deletions Scripts/build/Jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
}
}
}
Expand Down