OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/client/plugin/chromoting_instance.h" | 5 #include "remoting/client/plugin/chromoting_instance.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #if defined(OS_NACL) | 10 #if defined(OS_NACL) |
(...skipping 14 matching lines...) Expand all Loading... | |
25 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
26 #include "base/values.h" | 26 #include "base/values.h" |
27 #include "crypto/random.h" | 27 #include "crypto/random.h" |
28 #include "jingle/glue/thread_wrapper.h" | 28 #include "jingle/glue/thread_wrapper.h" |
29 #include "media/base/yuv_convert.h" | 29 #include "media/base/yuv_convert.h" |
30 #include "net/socket/ssl_server_socket.h" | 30 #include "net/socket/ssl_server_socket.h" |
31 #include "ppapi/cpp/completion_callback.h" | 31 #include "ppapi/cpp/completion_callback.h" |
32 #include "ppapi/cpp/dev/url_util_dev.h" | 32 #include "ppapi/cpp/dev/url_util_dev.h" |
33 #include "ppapi/cpp/image_data.h" | 33 #include "ppapi/cpp/image_data.h" |
34 #include "ppapi/cpp/input_event.h" | 34 #include "ppapi/cpp/input_event.h" |
35 #include "ppapi/cpp/private/uma_private.h" | |
35 #include "ppapi/cpp/rect.h" | 36 #include "ppapi/cpp/rect.h" |
36 #include "ppapi/cpp/var_array_buffer.h" | 37 #include "ppapi/cpp/var_array_buffer.h" |
37 #include "ppapi/cpp/var_dictionary.h" | 38 #include "ppapi/cpp/var_dictionary.h" |
38 #include "remoting/base/constants.h" | 39 #include "remoting/base/constants.h" |
39 #include "remoting/base/util.h" | 40 #include "remoting/base/util.h" |
40 #include "remoting/client/chromoting_client.h" | 41 #include "remoting/client/chromoting_client.h" |
41 #include "remoting/client/plugin/delegating_signal_strategy.h" | 42 #include "remoting/client/plugin/delegating_signal_strategy.h" |
42 #include "remoting/client/plugin/normalizing_input_filter_cros.h" | 43 #include "remoting/client/plugin/normalizing_input_filter_cros.h" |
43 #include "remoting/client/plugin/normalizing_input_filter_mac.h" | 44 #include "remoting/client/plugin/normalizing_input_filter_mac.h" |
44 #include "remoting/client/plugin/pepper_audio_player.h" | 45 #include "remoting/client/plugin/pepper_audio_player.h" |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1047 void ChromotingInstance::SendPerfStats() { | 1048 void ChromotingInstance::SendPerfStats() { |
1048 if (!video_renderer_.get()) { | 1049 if (!video_renderer_.get()) { |
1049 return; | 1050 return; |
1050 } | 1051 } |
1051 | 1052 |
1052 plugin_task_runner_->PostDelayedTask( | 1053 plugin_task_runner_->PostDelayedTask( |
1053 FROM_HERE, base::Bind(&ChromotingInstance::SendPerfStats, | 1054 FROM_HERE, base::Bind(&ChromotingInstance::SendPerfStats, |
1054 weak_factory_.GetWeakPtr()), | 1055 weak_factory_.GetWeakPtr()), |
1055 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); | 1056 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); |
1056 | 1057 |
1057 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 1058 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
Wez
2015/06/29 14:56:13
Suggest a comment here:
"Post performance stats a
anandc
2015/06/30 20:17:39
Done.
| |
1058 ChromotingStats* stats = video_renderer_->GetStats(); | 1059 ChromotingStats* stats = video_renderer_->GetStats(); |
1059 data->SetDouble("videoBandwidth", stats->video_bandwidth()->Rate()); | 1060 data->SetDouble("videoBandwidth", stats->video_bandwidth()->Rate()); |
1060 data->SetDouble("videoFrameRate", stats->video_frame_rate()->Rate()); | 1061 data->SetDouble("videoFrameRate", stats->video_frame_rate()->Rate()); |
1061 data->SetDouble("captureLatency", stats->video_capture_ms()->Average()); | 1062 data->SetDouble("captureLatency", stats->video_capture_ms()->Average()); |
1062 data->SetDouble("encodeLatency", stats->video_encode_ms()->Average()); | 1063 data->SetDouble("encodeLatency", stats->video_encode_ms()->Average()); |
1063 data->SetDouble("decodeLatency", stats->video_decode_ms()->Average()); | 1064 data->SetDouble("decodeLatency", stats->video_decode_ms()->Average()); |
1064 data->SetDouble("renderLatency", stats->video_paint_ms()->Average()); | 1065 data->SetDouble("renderLatency", stats->video_paint_ms()->Average()); |
1065 data->SetDouble("roundtripLatency", stats->round_trip_ms()->Average()); | 1066 data->SetDouble("roundtripLatency", stats->round_trip_ms()->Average()); |
1066 PostLegacyJsonMessage("onPerfStats", data.Pass()); | 1067 PostLegacyJsonMessage("onPerfStats", data.Pass()); |
1068 | |
1069 // Also update UMA histograms for video frame-rate, bandwidth and latencies. | |
Wez
2015/06/29 14:56:13
nit: "Also" implies that there is a comment earlie
anandc
2015/06/30 20:17:39
Done.
| |
1070 pp::UMAPrivate uma_interface(this); | |
1071 // We don't expect a frame-rate greater than 40fps, so set boundary to 40. | |
Wez
2015/06/29 14:56:13
This comment should appear next to a constant defi
anandc
2015/06/30 20:17:39
Thanks. Done.
Also updated to 41, based on explana
| |
1072 uma_interface.HistogramEnumeration( | |
1073 "Chromoting.Video.FrameRate", stats->video_fps()->Rate(), 40); | |
1074 uma_interface.HistogramEnumeration( | |
1075 "Chromoting.Video.FrameRate", | |
1076 stats->video_fps_with_empty_frames()->Rate(), 40); | |
1077 | |
1078 // For bandwidth, set the max value to 1MB/s, spread across 1000 buckets. | |
Wez
2015/06/29 14:56:13
Ditto.
What is the rationale for 1000 buckets?
anandc
2015/06/30 20:17:39
Done.
If, after we go live with these settings, we
| |
1079 uma_interface.HistogramCustomCounts("Chromoting.Video.Bandwidth", | |
1080 stats->video_bytes_per_s()->Rate(), 0, 1024000, 1000); | |
1081 | |
1082 // For, the latency metrics use a max value of 1000ms. | |
dahlke1
2015/06/24 23:12:11
The max latency for the past 7 days is 11,381ms. I
Wez
2015/06/29 14:56:13
Ditto re constants as above, and rationale for the
anandc
2015/06/30 20:17:39
Done.
| |
1083 uma_interface.HistogramCustomTimes("Chromoting.Video.CaptureLatency", | |
1084 stats->video_capture_ms()->Average(), 0, 1000, 1000); | |
1085 uma_interface.HistogramCustomTimes("Chromoting.Video.EncodeLatency", | |
1086 stats->video_encode_ms()->Average(), 0, 1000, 1000); | |
1087 uma_interface.HistogramCustomTimes("Chromoting.Video.RoundTripLatency", | |
1088 stats->round_trip_ms()->Average(), 0, 1000, 1000); | |
1067 } | 1089 } |
1068 | 1090 |
1069 // static | 1091 // static |
1070 void ChromotingInstance::RegisterLogMessageHandler() { | 1092 void ChromotingInstance::RegisterLogMessageHandler() { |
1071 base::AutoLock lock(g_logging_lock.Get()); | 1093 base::AutoLock lock(g_logging_lock.Get()); |
1072 | 1094 |
1073 VLOG(1) << "Registering global log handler"; | 1095 VLOG(1) << "Registering global log handler"; |
1074 | 1096 |
1075 // Record previous handler so we can call it in a chain. | 1097 // Record previous handler so we can call it in a chain. |
1076 g_logging_old_handler = logging::GetLogMessageHandler(); | 1098 g_logging_old_handler = logging::GetLogMessageHandler(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1196 | 1218 |
1197 #if !defined(OS_NACL) | 1219 #if !defined(OS_NACL) |
1198 // Log messages are forwarded to the webapp only in PNaCl version of the | 1220 // Log messages are forwarded to the webapp only in PNaCl version of the |
1199 // plugin, so ProcessLogToUI() needs to be called explicitly in the non-PNaCl | 1221 // plugin, so ProcessLogToUI() needs to be called explicitly in the non-PNaCl |
1200 // version. | 1222 // version. |
1201 ProcessLogToUI(message); | 1223 ProcessLogToUI(message); |
1202 #endif // !defined(OS_NACL) | 1224 #endif // !defined(OS_NACL) |
1203 } | 1225 } |
1204 | 1226 |
1205 } // namespace remoting | 1227 } // namespace remoting |
OLD | NEW |