| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/media/webrtc/webrtc_browsertest_perf.h" | 5 #include "chrome/browser/media/webrtc/webrtc_browsertest_perf.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 static void MaybePrintResultsForAudioReceive( | 25 static void MaybePrintResultsForAudioReceive( |
| 26 const std::string& ssrc, const base::DictionaryValue& pc_dict, | 26 const std::string& ssrc, const base::DictionaryValue& pc_dict, |
| 27 const std::string& modifier) { | 27 const std::string& modifier) { |
| 28 std::string value; | 28 std::string value; |
| 29 if (!pc_dict.GetString(Statistic("audioOutputLevel", ssrc), &value)) { | 29 if (!pc_dict.GetString(Statistic("audioOutputLevel", ssrc), &value)) { |
| 30 // Not an audio receive stream. | 30 // Not an audio receive stream. |
| 31 return; | 31 return; |
| 32 } | 32 } |
| 33 | 33 |
| 34 EXPECT_TRUE(pc_dict.GetString(Statistic("bytesReceived", ssrc), &value)); | |
| 35 perf_test::PrintResult( | |
| 36 "audio_bytes", modifier, "bytes_recv", value, "bytes", false); | |
| 37 EXPECT_TRUE(pc_dict.GetString(Statistic("packetsLost", ssrc), &value)); | 34 EXPECT_TRUE(pc_dict.GetString(Statistic("packetsLost", ssrc), &value)); |
| 38 perf_test::PrintResult( | 35 perf_test::PrintResult( |
| 39 "audio_misc", modifier, "packets_lost", value, "frames", false); | 36 "audio_misc", modifier, "packets_lost", value, "frames", false); |
| 40 EXPECT_TRUE(pc_dict.GetString(Statistic("googJitterReceived", ssrc), &value)); | 37 EXPECT_TRUE(pc_dict.GetString(Statistic("googJitterReceived", ssrc), &value)); |
| 41 perf_test::PrintResult( | 38 perf_test::PrintResult( |
| 42 "audio_rx", modifier, "goog_jitter_recv", value, "ms", false); | 39 "audio_rx", modifier, "goog_jitter_recv", value, "ms", false); |
| 43 | 40 |
| 44 EXPECT_TRUE(pc_dict.GetString(Statistic("googExpandRate", ssrc), &value)); | 41 EXPECT_TRUE(pc_dict.GetString(Statistic("googExpandRate", ssrc), &value)); |
| 45 perf_test::PrintResult( | 42 perf_test::PrintResult( |
| 46 "audio_rates", modifier, "goog_expand_rate", value, "%", false); | 43 "audio_rates", modifier, "goog_expand_rate", value, "%", false); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 57 | 54 |
| 58 static void MaybePrintResultsForAudioSend( | 55 static void MaybePrintResultsForAudioSend( |
| 59 const std::string& ssrc, const base::DictionaryValue& pc_dict, | 56 const std::string& ssrc, const base::DictionaryValue& pc_dict, |
| 60 const std::string& modifier) { | 57 const std::string& modifier) { |
| 61 std::string value; | 58 std::string value; |
| 62 if (!pc_dict.GetString(Statistic("audioInputLevel", ssrc), &value)) { | 59 if (!pc_dict.GetString(Statistic("audioInputLevel", ssrc), &value)) { |
| 63 // Not an audio send stream. | 60 // Not an audio send stream. |
| 64 return; | 61 return; |
| 65 } | 62 } |
| 66 | 63 |
| 67 EXPECT_TRUE(pc_dict.GetString(Statistic("bytesSent", ssrc), &value)); | |
| 68 perf_test::PrintResult( | |
| 69 "audio_bytes", modifier, "bytes_sent", value, "bytes", false); | |
| 70 EXPECT_TRUE(pc_dict.GetString(Statistic("googJitterReceived", ssrc), &value)); | 64 EXPECT_TRUE(pc_dict.GetString(Statistic("googJitterReceived", ssrc), &value)); |
| 71 perf_test::PrintResult( | 65 perf_test::PrintResult( |
| 72 "audio_tx", modifier, "goog_jitter_recv", value, "ms", false); | 66 "audio_tx", modifier, "goog_jitter_recv", value, "ms", false); |
| 73 EXPECT_TRUE(pc_dict.GetString(Statistic("googRtt", ssrc), &value)); | 67 EXPECT_TRUE(pc_dict.GetString(Statistic("googRtt", ssrc), &value)); |
| 74 perf_test::PrintResult( | 68 perf_test::PrintResult( |
| 75 "audio_tx", modifier, "goog_rtt", value, "ms", false); | 69 "audio_tx", modifier, "goog_rtt", value, "ms", false); |
| 76 EXPECT_TRUE( | 70 EXPECT_TRUE( |
| 77 pc_dict.GetString(Statistic("packetsSentPerSecond", ssrc), &value)); | 71 pc_dict.GetString(Statistic("packetsSentPerSecond", ssrc), &value)); |
| 78 perf_test::PrintResult("audio_tx", modifier, "packets_sent_per_second", value, | 72 perf_test::PrintResult("audio_tx", modifier, "packets_sent_per_second", value, |
| 79 "packets", false); | 73 "packets", false); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 90 | 84 |
| 91 // Graph these by unit: the dashboard expects all stats in one graph to have | 85 // Graph these by unit: the dashboard expects all stats in one graph to have |
| 92 // the same unit (e.g. ms, fps, etc). Most graphs, like video_fps, will also | 86 // the same unit (e.g. ms, fps, etc). Most graphs, like video_fps, will also |
| 93 // be populated by the counterparts on the video receiving side. | 87 // be populated by the counterparts on the video receiving side. |
| 94 perf_test::PrintResult( | 88 perf_test::PrintResult( |
| 95 "video_fps", modifier, "goog_frame_rate_sent", value, "fps", false); | 89 "video_fps", modifier, "goog_frame_rate_sent", value, "fps", false); |
| 96 EXPECT_TRUE(pc_dict.GetString(Statistic("googFrameRateInput", ssrc), &value)); | 90 EXPECT_TRUE(pc_dict.GetString(Statistic("googFrameRateInput", ssrc), &value)); |
| 97 perf_test::PrintResult( | 91 perf_test::PrintResult( |
| 98 "video_fps", modifier, "goog_frame_rate_input", value, "fps", false); | 92 "video_fps", modifier, "goog_frame_rate_input", value, "fps", false); |
| 99 | 93 |
| 100 EXPECT_TRUE(pc_dict.GetString(Statistic("bytesSent", ssrc), &value)); | |
| 101 perf_test::PrintResult( | |
| 102 "video_total_bytes", modifier, "bytes_sent", value, "bytes", false); | |
| 103 | |
| 104 EXPECT_TRUE(pc_dict.GetString(Statistic("googFirsReceived", ssrc), &value)); | 94 EXPECT_TRUE(pc_dict.GetString(Statistic("googFirsReceived", ssrc), &value)); |
| 105 perf_test::PrintResult( | 95 perf_test::PrintResult( |
| 106 "video_misc", modifier, "goog_firs_recv", value, "", false); | 96 "video_misc", modifier, "goog_firs_recv", value, "", false); |
| 107 EXPECT_TRUE(pc_dict.GetString(Statistic("googNacksReceived", ssrc), &value)); | 97 EXPECT_TRUE(pc_dict.GetString(Statistic("googNacksReceived", ssrc), &value)); |
| 108 perf_test::PrintResult( | 98 perf_test::PrintResult( |
| 109 "video_misc", modifier, "goog_nacks_recv", value, "", false); | 99 "video_misc", modifier, "goog_nacks_recv", value, "", false); |
| 110 | 100 |
| 111 EXPECT_TRUE(pc_dict.GetString(Statistic("googFrameWidthSent", ssrc), &value)); | 101 EXPECT_TRUE(pc_dict.GetString(Statistic("googFrameWidthSent", ssrc), &value)); |
| 112 perf_test::PrintResult("video_resolution", modifier, "goog_frame_width_sent", | 102 perf_test::PrintResult("video_resolution", modifier, "goog_frame_width_sent", |
| 113 value, "pixels", false); | 103 value, "pixels", false); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 141 "video_fps", modifier, "goog_frame_rate_recv", value, "fps", false); | 131 "video_fps", modifier, "goog_frame_rate_recv", value, "fps", false); |
| 142 EXPECT_TRUE( | 132 EXPECT_TRUE( |
| 143 pc_dict.GetString(Statistic("googFrameRateOutput", ssrc), &value)); | 133 pc_dict.GetString(Statistic("googFrameRateOutput", ssrc), &value)); |
| 144 perf_test::PrintResult( | 134 perf_test::PrintResult( |
| 145 "video_fps", modifier, "goog_frame_rate_output", value, "fps", false); | 135 "video_fps", modifier, "goog_frame_rate_output", value, "fps", false); |
| 146 | 136 |
| 147 EXPECT_TRUE(pc_dict.GetString(Statistic("packetsLost", ssrc), &value)); | 137 EXPECT_TRUE(pc_dict.GetString(Statistic("packetsLost", ssrc), &value)); |
| 148 perf_test::PrintResult("video_misc", modifier, "packets_lost", value, | 138 perf_test::PrintResult("video_misc", modifier, "packets_lost", value, |
| 149 "frames", false); | 139 "frames", false); |
| 150 | 140 |
| 151 EXPECT_TRUE(pc_dict.GetString(Statistic("bytesReceived", ssrc), &value)); | |
| 152 perf_test::PrintResult( | |
| 153 "video_total_bytes", modifier, "bytes_recv", value, "bytes", false); | |
| 154 | |
| 155 EXPECT_TRUE( | 141 EXPECT_TRUE( |
| 156 pc_dict.GetString(Statistic("googFrameWidthReceived", ssrc), &value)); | 142 pc_dict.GetString(Statistic("googFrameWidthReceived", ssrc), &value)); |
| 157 perf_test::PrintResult("video_resolution", modifier, "goog_frame_width_recv", | 143 perf_test::PrintResult("video_resolution", modifier, "goog_frame_width_recv", |
| 158 value, "pixels", false); | 144 value, "pixels", false); |
| 159 EXPECT_TRUE( | 145 EXPECT_TRUE( |
| 160 pc_dict.GetString(Statistic("googFrameHeightReceived", ssrc), &value)); | 146 pc_dict.GetString(Statistic("googFrameHeightReceived", ssrc), &value)); |
| 161 perf_test::PrintResult("video_resolution", modifier, "goog_frame_height_recv", | 147 perf_test::PrintResult("video_resolution", modifier, "goog_frame_height_recv", |
| 162 value, "pixels", false); | 148 value, "pixels", false); |
| 163 | 149 |
| 164 EXPECT_TRUE(pc_dict.GetString(Statistic("googCurrentDelayMs", ssrc), &value)); | 150 EXPECT_TRUE(pc_dict.GetString(Statistic("googCurrentDelayMs", ssrc), &value)); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 std::set<std::string>::const_iterator ssrc_iterator = | 258 std::set<std::string>::const_iterator ssrc_iterator = |
| 273 ssrc_identifiers.begin(); | 259 ssrc_identifiers.begin(); |
| 274 for (; ssrc_iterator != ssrc_identifiers.end(); ++ssrc_iterator) { | 260 for (; ssrc_iterator != ssrc_identifiers.end(); ++ssrc_iterator) { |
| 275 const std::string& ssrc = *ssrc_iterator; | 261 const std::string& ssrc = *ssrc_iterator; |
| 276 MaybePrintResultsForAudioReceive(ssrc, pc_dict, modifier); | 262 MaybePrintResultsForAudioReceive(ssrc, pc_dict, modifier); |
| 277 MaybePrintResultsForVideoReceive(ssrc, pc_dict, video_modifier); | 263 MaybePrintResultsForVideoReceive(ssrc, pc_dict, video_modifier); |
| 278 } | 264 } |
| 279 } | 265 } |
| 280 | 266 |
| 281 } // namespace test | 267 } // namespace test |
| OLD | NEW |