Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: remoting/test/fake_socket_factory.cc

Issue 2369243002: Report network stats in the scroll performance tests (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/test/fake_socket_factory.h ('k') | remoting/test/protocol_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/test/fake_socket_factory.cc
diff --git a/remoting/test/fake_socket_factory.cc b/remoting/test/fake_socket_factory.cc
index 39a9e862855a0dce3d809bb1c6925a9cf8070317..4c0748236480d64067737ec225ccedb4c1bf0944 100644
--- a/remoting/test/fake_socket_factory.cc
+++ b/remoting/test/fake_socket_factory.cc
@@ -176,8 +176,7 @@ FakePacketSocketFactory::PendingPacket::PendingPacket(
FakePacketSocketFactory::PendingPacket::PendingPacket(
const PendingPacket& other) = default;
-FakePacketSocketFactory::PendingPacket::~PendingPacket() {
-}
+FakePacketSocketFactory::PendingPacket::~PendingPacket() {}
FakePacketSocketFactory::FakePacketSocketFactory(
FakeNetworkDispatcher* dispatcher)
@@ -296,11 +295,17 @@ void FakePacketSocketFactory::ReceivePacket(
if (leaky_bucket_) {
delay = leaky_bucket_->AddPacket(data_size);
if (delay.is_max()) {
+ ++total_packets_dropped_;
// Drop the packet.
return;
}
}
+ total_buffer_delay_ += delay;
+ if (delay > max_buffer_delay_)
+ max_buffer_delay_ = delay;
+ ++total_packets_received_;
+
if (latency_average_ > base::TimeDelta()) {
delay += base::TimeDelta::FromMillisecondsD(
GetNormalRandom(latency_average_.InMillisecondsF(),
@@ -347,4 +352,11 @@ void FakePacketSocketFactory::DoReceivePacket() {
iter->second.Run(packet.from, packet.to, packet.data, packet.data_size);
}
+void FakePacketSocketFactory::ResetStats() {
+ total_packets_dropped_ = 0;
+ total_packets_received_ = 0;
+ total_buffer_delay_ = base::TimeDelta();
+ max_buffer_delay_ = base::TimeDelta();
+}
+
} // namespace remoting
« no previous file with comments | « remoting/test/fake_socket_factory.h ('k') | remoting/test/protocol_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698