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

Unified Diff: net/socket/udp_socket_perftest.cc

Issue 2253753002: Always use NonBlocking IO for UDP sockets on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 3 years, 8 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 | « net/socket/udp_server_socket.cc ('k') | net/socket/udp_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/udp_socket_perftest.cc
diff --git a/net/socket/udp_socket_perftest.cc b/net/socket/udp_socket_perftest.cc
index 190e157caac92228ecf287504be3639d7d5999d9..3f91895ac6e334075e4f09e9d087bbd553b476b8 100644
--- a/net/socket/udp_socket_perftest.cc
+++ b/net/socket/udp_socket_perftest.cc
@@ -44,9 +44,7 @@ class UDPSocketPerfTest : public PlatformTest {
int num_of_packets,
base::Closure done_callback);
- // Use non-blocking IO if |use_nonblocking_io| is true. This variable only
- // has effect on Windows.
- void WriteBenchmark(bool use_nonblocking_io);
+ void WriteBenchmark();
protected:
static const int kPacketSize = 1024;
@@ -86,7 +84,8 @@ void UDPSocketPerfTest::WritePacketsToSocket(UDPClientSocket* socket,
}
}
-void UDPSocketPerfTest::WriteBenchmark(bool use_nonblocking_io) {
+TEST_F(UDPSocketPerfTest, Write) {
+ base::PerfTimeLogger timer("UDP_socket_write");
base::MessageLoopForIO message_loop;
const uint16_t kPort = 9999;
@@ -95,8 +94,6 @@ void UDPSocketPerfTest::WriteBenchmark(bool use_nonblocking_io) {
CreateUDPAddress("127.0.0.1", kPort, &bind_address);
std::unique_ptr<UDPServerSocket> server(
new UDPServerSocket(nullptr, NetLogSource()));
- if (use_nonblocking_io)
- server->UseNonBlockingIO();
int rv = server->Listen(bind_address);
ASSERT_THAT(rv, IsOk());
@@ -106,8 +103,6 @@ void UDPSocketPerfTest::WriteBenchmark(bool use_nonblocking_io) {
std::unique_ptr<UDPClientSocket> client(
new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(),
nullptr, NetLogSource()));
- if (use_nonblocking_io)
- client->UseNonBlockingIO();
rv = client->Connect(server_address);
EXPECT_THAT(rv, IsOk());
@@ -122,16 +117,6 @@ void UDPSocketPerfTest::WriteBenchmark(bool use_nonblocking_io) {
LOG(INFO) << "Write speed: " << packets / 1024 / elapsed << " MB/s";
}
-TEST_F(UDPSocketPerfTest, Write) {
- base::PerfTimeLogger timer("UDP_socket_write");
- WriteBenchmark(false);
-}
-
-TEST_F(UDPSocketPerfTest, WriteNonBlocking) {
- base::PerfTimeLogger timer("UDP_socket_write_nonblocking");
- WriteBenchmark(true);
-}
-
} // namespace
} // namespace net
« no previous file with comments | « net/socket/udp_server_socket.cc ('k') | net/socket/udp_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698