Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions 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(SoakMode, soak_runtime, AZ::TimeMs(0), nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "How long to run the soak test for before dumping stats");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Consider adding time unit, mS, S, minutes etc to description.


void NetSoakTestSystemComponent::Reflect(AZ::ReflectContext* context)
{
Expand Down Expand Up @@ -173,7 +174,14 @@ 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));

total_elapsedMs += elapsedMs;
if (soak_runtime != AZ::TimeMs(0) && total_elapsedMs > soak_runtime)
{
DumpSoakStats();
exit(0);
}

NetSoakTestPackets::Small packet;

Expand All @@ -196,7 +204,7 @@ namespace NetSoakTest
unreliable.SetSmallDatum(2);
connection.SendUnreliablePacket(unreliable);
}

};

m_networkInterface->GetConnectionSet().VisitConnections(visitor);
Expand Down
4 changes: 3 additions & 1 deletion Gem/Code/Source/NetSoakTestSystemComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace NetSoakTest
void Deactivate() override;
////////////////////////////////////////////////////////////////////////


// AZ::TickBus::Handler overrides
void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
int GetTickOrder() override;
Expand All @@ -74,5 +74,7 @@ namespace NetSoakTest
private:
AzNetworking::INetworkInterface* m_networkInterface = nullptr;
AzNetworking::INetworkInterface* m_loopbackInterface = nullptr;

AZ::TimeMs totalElapsedMs = AZ::TimeMs(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_totalElapsedMs

};
}