Index: remoting/test/protocol_perftest.cc |
diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc |
index f0c32cc00f0667eddaca81cf41a1b58035e1300a..ce9eea4f758178579c54d91779e84d8fd939eeeb 100644 |
--- a/remoting/test/protocol_perftest.cc |
+++ b/remoting/test/protocol_perftest.cc |
@@ -43,7 +43,6 @@ |
#include "remoting/test/fake_network_dispatcher.h" |
#include "remoting/test/fake_port_allocator.h" |
#include "remoting/test/fake_socket_factory.h" |
-#include "remoting/test/scroll_frame_generator.h" |
#include "testing/gtest/include/gtest/gtest.h" |
namespace remoting { |
@@ -416,8 +415,63 @@ |
secret_fetched_callback.Run(kHostPin); |
} |
- void MeasureTotalLatency(bool use_webrtc); |
- void MeasureScrollPerformance(bool use_webrtc); |
+ void MeasureTotalLatency(bool webrtc) { |
+ scoped_refptr<test::CyclicFrameGenerator> frame_generator = |
+ test::CyclicFrameGenerator::Create(); |
+ frame_generator->set_draw_barcode(true); |
+ |
+ desktop_environment_factory_.set_frame_generator(base::Bind( |
+ &test::CyclicFrameGenerator::GenerateFrame, frame_generator)); |
+ |
+ StartHostAndClient(webrtc, protocol::ChannelConfig::CODEC_VP8); |
+ ASSERT_NO_FATAL_FAILURE(WaitConnected()); |
+ |
+ int skipped_frames = 0; |
+ while (skipped_frames < 10) { |
+ std::unique_ptr<webrtc::DesktopFrame> frame = ReceiveFrame(); |
+ test::CyclicFrameGenerator::ChangeInfoList changes = |
+ frame_generator->GetChangeList(frame.get()); |
+ skipped_frames += changes.size(); |
+ } |
+ |
+ base::TimeDelta total_latency_big_frames; |
+ int big_frame_count = 0; |
+ base::TimeDelta total_latency_small_frames; |
+ int small_frame_count = 0; |
+ |
+ while (big_frame_count + small_frame_count < 30) { |
+ std::unique_ptr<webrtc::DesktopFrame> frame = ReceiveFrame(); |
+ base::TimeTicks frame_received_time = base::TimeTicks::Now(); |
+ test::CyclicFrameGenerator::ChangeInfoList changes = |
+ frame_generator->GetChangeList(frame.get()); |
+ for (auto& change_info : changes) { |
+ base::TimeDelta latency = frame_received_time - change_info.timestamp; |
+ switch (change_info.type) { |
+ case test::CyclicFrameGenerator::ChangeType::NO_CHANGES: |
+ NOTREACHED(); |
+ break; |
+ case test::CyclicFrameGenerator::ChangeType::FULL: |
+ total_latency_big_frames += latency; |
+ ++big_frame_count; |
+ break; |
+ case test::CyclicFrameGenerator::ChangeType::CURSOR: |
+ total_latency_small_frames += latency; |
+ ++small_frame_count; |
+ break; |
+ } |
+ } |
+ } |
+ |
+ CHECK(big_frame_count); |
+ VLOG(0) << "Average latency for big frames: " |
+ << (total_latency_big_frames / big_frame_count).InMillisecondsF(); |
+ |
+ if (small_frame_count) { |
+ VLOG(0) |
+ << "Average latency for small frames: " |
+ << (total_latency_small_frames / small_frame_count).InMillisecondsF(); |
+ } |
+ } |
base::MessageLoopForIO message_loop_; |
@@ -481,9 +535,9 @@ |
LimitedBandwidth, |
ProtocolPerfTest, |
::testing::Values( |
- // 100 Mbps |
- NetworkPerformanceParams(12500000, 12500000, 2, 1, 0.0), |
- // 8 Mbps |
+ // 100 MBps |
+ NetworkPerformanceParams(800000000, 800000000, 2, 1, 0.0), |
+ // 8 MBps |
NetworkPerformanceParams(1000000, 300000, 30, 5, 0.01), |
NetworkPerformanceParams(1000000, 2000000, 30, 5, 0.01), |
// 800 kBps |
@@ -583,68 +637,6 @@ |
LOG(INFO) << "Average: " << (sum / kFrames).InMillisecondsF(); |
} |
-// TotalLatency[Ice|Webrtc] tests measure video latency in the case when the |
-// whole screen is updated occasionally. It's intended to simulate the case when |
-// user actions (e.g. Alt-Tab, click on the task bar) cause whole screen to be |
-// updated. |
-void ProtocolPerfTest::MeasureTotalLatency(bool use_webrtc) { |
- scoped_refptr<test::CyclicFrameGenerator> frame_generator = |
- test::CyclicFrameGenerator::Create(); |
- frame_generator->set_draw_barcode(true); |
- |
- desktop_environment_factory_.set_frame_generator( |
- base::Bind(&test::CyclicFrameGenerator::GenerateFrame, frame_generator)); |
- |
- StartHostAndClient(use_webrtc, protocol::ChannelConfig::CODEC_VP8); |
- ASSERT_NO_FATAL_FAILURE(WaitConnected()); |
- |
- int skipped_frames = 0; |
- while (skipped_frames < 10) { |
- std::unique_ptr<webrtc::DesktopFrame> frame = ReceiveFrame(); |
- test::CyclicFrameGenerator::ChangeInfoList changes = |
- frame_generator->GetChangeList(frame.get()); |
- skipped_frames += changes.size(); |
- } |
- |
- base::TimeDelta total_latency_big_frames; |
- int big_frame_count = 0; |
- base::TimeDelta total_latency_small_frames; |
- int small_frame_count = 0; |
- |
- while (big_frame_count + small_frame_count < 30) { |
- std::unique_ptr<webrtc::DesktopFrame> frame = ReceiveFrame(); |
- base::TimeTicks frame_received_time = base::TimeTicks::Now(); |
- test::CyclicFrameGenerator::ChangeInfoList changes = |
- frame_generator->GetChangeList(frame.get()); |
- for (auto& change_info : changes) { |
- base::TimeDelta latency = frame_received_time - change_info.timestamp; |
- switch (change_info.type) { |
- case test::CyclicFrameGenerator::ChangeType::NO_CHANGES: |
- NOTREACHED(); |
- break; |
- case test::CyclicFrameGenerator::ChangeType::FULL: |
- total_latency_big_frames += latency; |
- ++big_frame_count; |
- break; |
- case test::CyclicFrameGenerator::ChangeType::CURSOR: |
- total_latency_small_frames += latency; |
- ++small_frame_count; |
- break; |
- } |
- } |
- } |
- |
- CHECK(big_frame_count); |
- VLOG(0) << "Average latency for big frames: " |
- << (total_latency_big_frames / big_frame_count).InMillisecondsF(); |
- |
- if (small_frame_count) { |
- VLOG(0) |
- << "Average latency for small frames: " |
- << (total_latency_small_frames / small_frame_count).InMillisecondsF(); |
- } |
-} |
- |
TEST_P(ProtocolPerfTest, TotalLatencyIce) { |
MeasureTotalLatency(false); |
} |
@@ -653,49 +645,4 @@ |
MeasureTotalLatency(true); |
} |
-// ScrollPerformance[Ice|Webrtc] tests simulate whole screen being scrolled |
-// continuously. They measure FPS and video latency. |
-void ProtocolPerfTest::MeasureScrollPerformance(bool use_webrtc) { |
- scoped_refptr<test::ScrollFrameGenerator> frame_generator = |
- new test::ScrollFrameGenerator(); |
- |
- desktop_environment_factory_.set_frame_generator( |
- base::Bind(&test::ScrollFrameGenerator::GenerateFrame, frame_generator)); |
- |
- StartHostAndClient(use_webrtc, protocol::ChannelConfig::CODEC_VP8); |
- ASSERT_NO_FATAL_FAILURE(WaitConnected()); |
- |
- base::TimeTicks start_time = base::TimeTicks::Now(); |
- const base::TimeDelta kWarmUpTime = base::TimeDelta::FromSeconds(2); |
- while ((base::TimeTicks::Now() - start_time) < kWarmUpTime) { |
- ReceiveFrame(); |
- } |
- |
- // Run the test for 2 seconds. |
- const base::TimeDelta kTestTime = base::TimeDelta::FromSeconds(2); |
- |
- int num_frames = 0; |
- base::TimeDelta total_latency; |
- start_time = base::TimeTicks::Now(); |
- while ((base::TimeTicks::Now() - start_time) < kTestTime) { |
- std::unique_ptr<webrtc::DesktopFrame> frame = ReceiveFrame(); |
- ++num_frames; |
- total_latency += frame_generator->GetFrameLatency(*frame); |
- } |
- |
- VLOG(0) << "FPS: " |
- << num_frames / (base::TimeTicks::Now() - start_time).InSecondsF(); |
- |
- VLOG(0) << "Average latency: " |
- << (total_latency).InMillisecondsF() / num_frames; |
-} |
- |
-TEST_P(ProtocolPerfTest, ScrollPerformanceIce) { |
- MeasureScrollPerformance(false); |
-} |
- |
-TEST_P(ProtocolPerfTest, ScrollPerformanceWebrtc) { |
- MeasureScrollPerformance(true); |
-} |
- |
} // namespace remoting |