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

Side by Side Diff: webrtc/tools/event_log_visualizer/analyzer.cc

Issue 2826313004: Added -show_detector_state which show the detector state in the total bitrate graph. (Closed)
Patch Set: Feedback 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 876 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
877 plot->SetSuggestedYAxis(0, 10, "Percent lost packets", kBottomMargin, 877 plot->SetSuggestedYAxis(0, 10, "Percent lost packets", kBottomMargin,
878 kTopMargin); 878 kTopMargin);
879 plot->SetTitle("Reported packet loss"); 879 plot->SetTitle("Reported packet loss");
880 plot->AppendTimeSeries(std::move(time_series)); 880 plot->AppendTimeSeries(std::move(time_series));
881 } 881 }
882 882
883 // Plot the total bandwidth used by all RTP streams. 883 // Plot the total bandwidth used by all RTP streams.
884 void EventLogAnalyzer::CreateTotalBitrateGraph( 884 void EventLogAnalyzer::CreateTotalBitrateGraph(
885 PacketDirection desired_direction, 885 PacketDirection desired_direction,
886 Plot* plot) { 886 Plot* plot,
887 bool show_detector_state) {
887 struct TimestampSize { 888 struct TimestampSize {
888 TimestampSize(uint64_t t, size_t s) : timestamp(t), size(s) {} 889 TimestampSize(uint64_t t, size_t s) : timestamp(t), size(s) {}
889 uint64_t timestamp; 890 uint64_t timestamp;
890 size_t size; 891 size_t size;
891 }; 892 };
892 std::vector<TimestampSize> packets; 893 std::vector<TimestampSize> packets;
893 894
894 PacketDirection direction; 895 PacketDirection direction;
895 size_t total_length; 896 size_t total_length;
896 897
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 // Overlay the send-side bandwidth estimate over the outgoing bitrate. 937 // Overlay the send-side bandwidth estimate over the outgoing bitrate.
937 if (desired_direction == kOutgoingPacket) { 938 if (desired_direction == kOutgoingPacket) {
938 TimeSeries loss_series("Loss-based estimate", LINE_STEP_GRAPH); 939 TimeSeries loss_series("Loss-based estimate", LINE_STEP_GRAPH);
939 for (auto& loss_update : bwe_loss_updates_) { 940 for (auto& loss_update : bwe_loss_updates_) {
940 float x = 941 float x =
941 static_cast<float>(loss_update.timestamp - begin_time_) / 1000000; 942 static_cast<float>(loss_update.timestamp - begin_time_) / 1000000;
942 float y = static_cast<float>(loss_update.new_bitrate) / 1000; 943 float y = static_cast<float>(loss_update.new_bitrate) / 1000;
943 loss_series.points.emplace_back(x, y); 944 loss_series.points.emplace_back(x, y);
944 } 945 }
945 946
947 TimeSeries overusing_series("Overusing", VSPAN_GRAPH);
948 overusing_series.color = "#ff8e82";
949 TimeSeries underusing_series("Underusing", VSPAN_GRAPH);
950 underusing_series.color = "#5092fc";
951 TimeSeries normal_series("Normal", VSPAN_GRAPH);
952 normal_series.color = "#c4ffc4";
953 normal_series.points.emplace_back(0, 0);
946 TimeSeries delay_series("Delay-based estimate", LINE_STEP_GRAPH); 954 TimeSeries delay_series("Delay-based estimate", LINE_STEP_GRAPH);
955 TimeSeries* last_series = &normal_series;
956 BandwidthUsage detector_state = BandwidthUsage::kBwNormal;
957
947 for (auto& delay_update : bwe_delay_updates_) { 958 for (auto& delay_update : bwe_delay_updates_) {
948 float x = 959 float x =
949 static_cast<float>(delay_update.timestamp - begin_time_) / 1000000; 960 static_cast<float>(delay_update.timestamp - begin_time_) / 1000000;
950 float y = static_cast<float>(delay_update.bitrate_bps) / 1000; 961 float y = static_cast<float>(delay_update.bitrate_bps) / 1000;
962
963 if (detector_state != delay_update.detector_state) {
964 RTC_CHECK(last_series);
965 last_series->points.emplace_back(x, 0);
966 last_series = nullptr;
967 }
968
969 switch (delay_update.detector_state) {
970 case BandwidthUsage::kBwNormal:
971 if (detector_state != BandwidthUsage::kBwNormal) {
972 normal_series.points.emplace_back(x, 0);
973 last_series = &normal_series;
974 detector_state = delay_update.detector_state;
975 }
976 break;
977 case BandwidthUsage::kBwUnderusing:
978 if (detector_state != BandwidthUsage::kBwUnderusing) {
979 underusing_series.points.emplace_back(x, 0);
980 last_series = &underusing_series;
981 detector_state = delay_update.detector_state;
982 }
983 break;
984 case BandwidthUsage::kBwOverusing:
985 if (detector_state != BandwidthUsage::kBwOverusing) {
986 overusing_series.points.emplace_back(x, 0);
987 last_series = &overusing_series;
988 detector_state = delay_update.detector_state;
989 }
990 break;
991 }
992
951 delay_series.points.emplace_back(x, y); 993 delay_series.points.emplace_back(x, y);
952 } 994 }
953 995
996 RTC_CHECK(last_series);
997 last_series->points.emplace_back(end_time_, 0);
998
954 TimeSeries created_series("Probe cluster created.", DOT_GRAPH); 999 TimeSeries created_series("Probe cluster created.", DOT_GRAPH);
955 for (auto& cluster : bwe_probe_cluster_created_events_) { 1000 for (auto& cluster : bwe_probe_cluster_created_events_) {
956 float x = static_cast<float>(cluster.timestamp - begin_time_) / 1000000; 1001 float x = static_cast<float>(cluster.timestamp - begin_time_) / 1000000;
957 float y = static_cast<float>(cluster.bitrate_bps) / 1000; 1002 float y = static_cast<float>(cluster.bitrate_bps) / 1000;
958 created_series.points.emplace_back(x, y); 1003 created_series.points.emplace_back(x, y);
959 } 1004 }
960 1005
961 TimeSeries result_series("Probing results.", DOT_GRAPH); 1006 TimeSeries result_series("Probing results.", DOT_GRAPH);
962 for (auto& result : bwe_probe_result_events_) { 1007 for (auto& result : bwe_probe_result_events_) {
963 if (result.bitrate_bps) { 1008 if (result.bitrate_bps) {
964 float x = static_cast<float>(result.timestamp - begin_time_) / 1000000; 1009 float x = static_cast<float>(result.timestamp - begin_time_) / 1000000;
965 float y = static_cast<float>(*result.bitrate_bps) / 1000; 1010 float y = static_cast<float>(*result.bitrate_bps) / 1000;
966 result_series.points.emplace_back(x, y); 1011 result_series.points.emplace_back(x, y);
967 } 1012 }
968 } 1013 }
1014
1015 if (show_detector_state) {
1016 plot->AppendTimeSeries(std::move(underusing_series));
1017 plot->AppendTimeSeries(std::move(normal_series));
1018 plot->AppendTimeSeries(std::move(overusing_series));
1019 }
1020
1021 plot->AppendTimeSeries(std::move(bitrate_series));
969 plot->AppendTimeSeries(std::move(loss_series)); 1022 plot->AppendTimeSeries(std::move(loss_series));
970 plot->AppendTimeSeries(std::move(delay_series)); 1023 plot->AppendTimeSeries(std::move(delay_series));
971 plot->AppendTimeSeries(std::move(created_series)); 1024 plot->AppendTimeSeries(std::move(created_series));
972 plot->AppendTimeSeries(std::move(result_series)); 1025 plot->AppendTimeSeries(std::move(result_series));
973 } 1026 }
974 1027
975 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 1028 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
976 plot->SetSuggestedYAxis(0, 1, "Bitrate (kbps)", kBottomMargin, kTopMargin); 1029 plot->SetSuggestedYAxis(0, 1, "Bitrate (kbps)", kBottomMargin, kTopMargin);
977 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) { 1030 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) {
978 plot->SetTitle("Incoming RTP bitrate"); 1031 plot->SetTitle("Incoming RTP bitrate");
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 }, 1441 },
1389 audio_network_adaptation_events_, begin_time_, &time_series); 1442 audio_network_adaptation_events_, begin_time_, &time_series);
1390 plot->AppendTimeSeries(std::move(time_series)); 1443 plot->AppendTimeSeries(std::move(time_series));
1391 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 1444 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
1392 plot->SetSuggestedYAxis(0, 1, "Number of channels (1 (mono)/2 (stereo))", 1445 plot->SetSuggestedYAxis(0, 1, "Number of channels (1 (mono)/2 (stereo))",
1393 kBottomMargin, kTopMargin); 1446 kBottomMargin, kTopMargin);
1394 plot->SetTitle("Reported audio encoder number of channels"); 1447 plot->SetTitle("Reported audio encoder number of channels");
1395 } 1448 }
1396 } // namespace plotting 1449 } // namespace plotting
1397 } // namespace webrtc 1450 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698