summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsergeyu <sergeyu@chromium.org>2015-09-16 17:45:24 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-17 00:46:24 +0000
commitaa1f0239f0a5d0ace93c63022829fcf39fee99e7 (patch)
tree0a15e80333e1e0925ef42596526f5b066d052b66
parentd24401d628410cc67c4ae7a7bc9c3a5e65fa0572 (diff)
downloadchromium_src-aa1f0239f0a5d0ace93c63022829fcf39fee99e7.zip
chromium_src-aa1f0239f0a5d0ace93c63022829fcf39fee99e7.tar.gz
chromium_src-aa1f0239f0a5d0ace93c63022829fcf39fee99e7.tar.bz2
Rename/Move ChromotingStats->protocol::PerformanceTracker
The class will be used directly from protocol dispatchers, so it needs to be accessible on the protocol layer. Also renamed it so the name reflects what the class is responsible for. Review URL: https://codereview.chromium.org/1351723004 Cr-Commit-Position: refs/heads/master@{#349295}
-rw-r--r--remoting/client/chromoting_client.h4
-rw-r--r--remoting/client/client_status_logger.cc7
-rw-r--r--remoting/client/client_status_logger.h6
-rw-r--r--remoting/client/client_status_logger_unittest.cc6
-rw-r--r--remoting/client/jni/chromoting_jni_instance.cc24
-rw-r--r--remoting/client/plugin/chromoting_instance.cc27
-rw-r--r--remoting/client/plugin/chromoting_instance.h2
-rw-r--r--remoting/client/plugin/pepper_video_renderer_2d.cc6
-rw-r--r--remoting/client/plugin/pepper_video_renderer_2d.h2
-rw-r--r--remoting/client/plugin/pepper_video_renderer_3d.cc12
-rw-r--r--remoting/client/plugin/pepper_video_renderer_3d.h6
-rw-r--r--remoting/client/server_log_entry_client.cc16
-rw-r--r--remoting/client/server_log_entry_client.h7
-rw-r--r--remoting/client/server_log_entry_client_unittest.cc6
-rw-r--r--remoting/client/software_video_renderer.cc10
-rw-r--r--remoting/client/software_video_renderer.h13
-rw-r--r--remoting/client/video_renderer.h10
-rw-r--r--remoting/host/cast_extension_session.cc3
-rw-r--r--remoting/protocol/performance_tracker.cc (renamed from remoting/client/chromoting_stats.cc)22
-rw-r--r--remoting/protocol/performance_tracker.h (renamed from remoting/client/chromoting_stats.h)24
-rw-r--r--remoting/remoting_srcs.gypi4
-rw-r--r--remoting/test/protocol_perftest.cc4
-rw-r--r--remoting/test/test_video_renderer.cc4
-rw-r--r--remoting/test/test_video_renderer.h2
24 files changed, 124 insertions, 103 deletions
diff --git a/remoting/client/chromoting_client.h b/remoting/client/chromoting_client.h
index 605cdee..ce7fbcf 100644
--- a/remoting/client/chromoting_client.h
+++ b/remoting/client/chromoting_client.h
@@ -11,12 +11,12 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
-#include "remoting/client/chromoting_stats.h"
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/clipboard_stub.h"
#include "remoting/protocol/connection_to_host.h"
#include "remoting/protocol/connection_to_host_impl.h"
#include "remoting/protocol/input_stub.h"
+#include "remoting/protocol/performance_tracker.h"
#include "remoting/protocol/video_stub.h"
namespace base {
@@ -120,7 +120,7 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
bool host_capabilities_received_;
// Record the statistics of the connection.
- ChromotingStats stats_;
+ protocol::PerformanceTracker perf_tracker_;
DISALLOW_COPY_AND_ASSIGN(ChromotingClient);
};
diff --git a/remoting/client/client_status_logger.cc b/remoting/client/client_status_logger.cc
index 40b4ecf..c7cc0fe 100644
--- a/remoting/client/client_status_logger.cc
+++ b/remoting/client/client_status_logger.cc
@@ -7,8 +7,8 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/rand_util.h"
-#include "remoting/client/chromoting_stats.h"
#include "remoting/client/server_log_entry_client.h"
+#include "remoting/protocol/performance_tracker.h"
using remoting::protocol::ConnectionToHost;
@@ -91,12 +91,13 @@ void ClientStatusLogger::LogSessionStateChange(
log_to_server_.Log(*entry.get());
}
-void ClientStatusLogger::LogStatistics(ChromotingStats* statistics) {
+void ClientStatusLogger::LogStatistics(
+ protocol::PerformanceTracker* perf_tracker) {
DCHECK(CalledOnValidThread());
MaybeExpireSessionId();
- scoped_ptr<ServerLogEntry> entry(MakeLogEntryForStatistics(statistics));
+ scoped_ptr<ServerLogEntry> entry(MakeLogEntryForStatistics(perf_tracker));
AddClientFieldsToLogEntry(entry.get());
entry->AddModeField(log_to_server_.mode());
AddSessionIdToLogEntry(entry.get(), session_id_);
diff --git a/remoting/client/client_status_logger.h b/remoting/client/client_status_logger.h
index afc64b9..4d15ac1 100644
--- a/remoting/client/client_status_logger.h
+++ b/remoting/client/client_status_logger.h
@@ -13,7 +13,9 @@
namespace remoting {
-class ChromotingStats;
+namespace protocol {
+class PerformanceTracker;
+} // namespace protocol
// ClientStatusLogger sends client log entries to a server.
// The contents of the log entries are described in server_log_entry_client.cc.
@@ -27,7 +29,7 @@ class ClientStatusLogger : public base::NonThreadSafe {
void LogSessionStateChange(protocol::ConnectionToHost::State state,
protocol::ErrorCode error);
- void LogStatistics(remoting::ChromotingStats* statistics);
+ void LogStatistics(protocol::PerformanceTracker* perf_tracker);
// Allows test code to fake SignalStrategy state change events.
void SetSignalingStateForTest(SignalStrategy::State state);
diff --git a/remoting/client/client_status_logger_unittest.cc b/remoting/client/client_status_logger_unittest.cc
index 5332a9c..352d54f 100644
--- a/remoting/client/client_status_logger_unittest.cc
+++ b/remoting/client/client_status_logger_unittest.cc
@@ -5,7 +5,7 @@
#include "remoting/client/client_status_logger.h"
#include "base/message_loop/message_loop.h"
-#include "remoting/client/chromoting_stats.h"
+#include "remoting/protocol/performance_tracker.h"
#include "remoting/signaling/mock_signal_strategy.h"
#include "remoting/signaling/server_log_entry_unittest.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -141,8 +141,8 @@ TEST_F(ClientStatusLoggerTest, LogStatistics) {
.RetiresOnSaturation();
}
- ChromotingStats stats;
- client_status_logger_->LogStatistics(&stats);
+ protocol::PerformanceTracker perf_tracker;
+ client_status_logger_->LogStatistics(&perf_tracker);
client_status_logger_->SetSignalingStateForTest(SignalStrategy::CONNECTED);
client_status_logger_->SetSignalingStateForTest(SignalStrategy::DISCONNECTED);
diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc
index 62c4edf..f2f63b6 100644
--- a/remoting/client/jni/chromoting_jni_instance.cc
+++ b/remoting/client/jni/chromoting_jni_instance.cc
@@ -299,7 +299,7 @@ void ChromotingJniInstance::RecordPaintTime(int64 paint_time_ms) {
}
if (stats_logging_enabled_)
- video_renderer_->GetStats()->RecordPaintTime(paint_time_ms);
+ video_renderer_->GetPerformanceTracker()->RecordPaintTime(paint_time_ms);
}
void ChromotingJniInstance::OnConnectionState(
@@ -492,16 +492,18 @@ void ChromotingJniInstance::LogPerfStats() {
if (!stats_logging_enabled_)
return;
- ChromotingStats* stats = video_renderer_->GetStats();
- __android_log_print(ANDROID_LOG_INFO, "stats",
- "Bandwidth:%.0f FrameRate:%.1f Capture:%.1f Encode:%.1f "
- "Decode:%.1f Render:%.1f Latency:%.0f",
- stats->video_bandwidth(), stats->video_frame_rate(),
- stats->video_capture_ms(), stats->video_encode_ms(),
- stats->video_decode_ms(), stats->video_paint_ms(),
- stats->round_trip_ms());
-
- client_status_logger_->LogStatistics(stats);
+ protocol::PerformanceTracker* perf_tracker =
+ video_renderer_->GetPerformanceTracker();
+ __android_log_print(
+ ANDROID_LOG_INFO, "stats",
+ "Bandwidth:%.0f FrameRate:%.1f Capture:%.1f Encode:%.1f "
+ "Decode:%.1f Render:%.1f Latency:%.0f",
+ perf_tracker->video_bandwidth(), perf_tracker->video_frame_rate(),
+ perf_tracker->video_capture_ms(), perf_tracker->video_encode_ms(),
+ perf_tracker->video_decode_ms(), perf_tracker->video_paint_ms(),
+ perf_tracker->round_trip_ms());
+
+ client_status_logger_->LogStatistics(perf_tracker);
jni_runtime_->network_task_runner()->PostDelayedTask(
FROM_HERE, base::Bind(&ChromotingJniInstance::LogPerfStats, this),
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index 9111f61..82f1e40 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -641,7 +641,7 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) {
CHECK(video_renderer_);
- video_renderer_->GetStats()->SetUpdateUmaCallbacks(
+ video_renderer_->GetPerformanceTracker()->SetUpdateUmaCallbacks(
base::Bind(&ChromotingInstance::UpdateUmaCustomHistogram,
weak_factory_.GetWeakPtr(), true),
base::Bind(&ChromotingInstance::UpdateUmaCustomHistogram,
@@ -719,7 +719,7 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) {
FROM_HERE, base::Bind(&ChromotingInstance::SendPerfStats,
weak_factory_.GetWeakPtr()),
base::TimeDelta::FromSeconds(
- ChromotingStats::kStatsUpdateFrequencyInSeconds));
+ protocol::PerformanceTracker::kStatsUpdateFrequencyInSeconds));
}
void ChromotingInstance::HandleDisconnect(const base::DictionaryValue& data) {
@@ -1032,25 +1032,26 @@ void ChromotingInstance::SendPerfStats() {
FROM_HERE, base::Bind(&ChromotingInstance::SendPerfStats,
weak_factory_.GetWeakPtr()),
base::TimeDelta::FromSeconds(
- ChromotingStats::kStatsUpdateFrequencyInSeconds));
+ protocol::PerformanceTracker::kStatsUpdateFrequencyInSeconds));
// Fetch performance stats from the VideoRenderer and send them to the client
// for display to users.
scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
- ChromotingStats* stats = video_renderer_->GetStats();
- data->SetDouble("videoBandwidth", stats->video_bandwidth());
- data->SetDouble("videoFrameRate", stats->video_frame_rate());
- data->SetDouble("captureLatency", stats->video_capture_ms());
- data->SetDouble("encodeLatency", stats->video_encode_ms());
- data->SetDouble("decodeLatency", stats->video_decode_ms());
- data->SetDouble("renderLatency", stats->video_paint_ms());
- data->SetDouble("roundtripLatency", stats->round_trip_ms());
+ protocol::PerformanceTracker* perf_tracker =
+ video_renderer_->GetPerformanceTracker();
+ data->SetDouble("videoBandwidth", perf_tracker->video_bandwidth());
+ data->SetDouble("videoFrameRate", perf_tracker->video_frame_rate());
+ data->SetDouble("captureLatency", perf_tracker->video_capture_ms());
+ data->SetDouble("encodeLatency", perf_tracker->video_encode_ms());
+ data->SetDouble("decodeLatency", perf_tracker->video_decode_ms());
+ data->SetDouble("renderLatency", perf_tracker->video_paint_ms());
+ data->SetDouble("roundtripLatency", perf_tracker->round_trip_ms());
PostLegacyJsonMessage("onPerfStats", data.Pass());
// Record the video frame-rate, packet-rate and bandwidth stats to UMA.
- // TODO(anandc): Create a timer in ChromotingStats to do this work.
+ // TODO(anandc): Create a timer in PerformanceTracker to do this work.
// See http://crbug/508602.
- stats->UploadRateStatsToUma();
+ perf_tracker->UploadRateStatsToUma();
}
// static
diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h
index 9e453d5..07fdad4 100644
--- a/remoting/client/plugin/chromoting_instance.h
+++ b/remoting/client/plugin/chromoting_instance.h
@@ -17,7 +17,6 @@
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/text_input_controller.h"
#include "ppapi/cpp/var.h"
-#include "remoting/client/chromoting_stats.h"
#include "remoting/client/client_context.h"
#include "remoting/client/client_user_interface.h"
#include "remoting/client/empty_cursor_filter.h"
@@ -35,6 +34,7 @@
#include "remoting/protocol/input_event_tracker.h"
#include "remoting/protocol/mouse_input_filter.h"
#include "remoting/protocol/negotiating_client_authenticator.h"
+#include "remoting/protocol/performance_tracker.h"
#include "remoting/protocol/third_party_client_authenticator.h"
namespace base {
diff --git a/remoting/client/plugin/pepper_video_renderer_2d.cc b/remoting/client/plugin/pepper_video_renderer_2d.cc
index 5d07277..94650fe 100644
--- a/remoting/client/plugin/pepper_video_renderer_2d.cc
+++ b/remoting/client/plugin/pepper_video_renderer_2d.cc
@@ -15,10 +15,10 @@
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/size.h"
#include "remoting/base/util.h"
-#include "remoting/client/chromoting_stats.h"
#include "remoting/client/client_context.h"
#include "remoting/client/software_video_renderer.h"
#include "remoting/proto/video.pb.h"
+#include "remoting/protocol/performance_tracker.h"
#include "third_party/libyuv/include/libyuv/scale_argb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
@@ -102,10 +102,10 @@ void PepperVideoRenderer2D::OnSessionConfig(
software_video_renderer_->OnSessionConfig(config);
}
-ChromotingStats* PepperVideoRenderer2D::GetStats() {
+protocol::PerformanceTracker* PepperVideoRenderer2D::GetPerformanceTracker() {
DCHECK(thread_checker_.CalledOnValidThread());
- return software_video_renderer_->GetStats();
+ return software_video_renderer_->GetPerformanceTracker();
}
protocol::VideoStub* PepperVideoRenderer2D::GetVideoStub() {
diff --git a/remoting/client/plugin/pepper_video_renderer_2d.h b/remoting/client/plugin/pepper_video_renderer_2d.h
index 6f8d35d..2da59c6 100644
--- a/remoting/client/plugin/pepper_video_renderer_2d.h
+++ b/remoting/client/plugin/pepper_video_renderer_2d.h
@@ -52,7 +52,7 @@ class PepperVideoRenderer2D : public PepperVideoRenderer,
// VideoRenderer interface.
void OnSessionConfig(const protocol::SessionConfig& config) override;
- ChromotingStats* GetStats() override;
+ protocol::PerformanceTracker* GetPerformanceTracker() override;
protocol::VideoStub* GetVideoStub() override;
private:
diff --git a/remoting/client/plugin/pepper_video_renderer_3d.cc b/remoting/client/plugin/pepper_video_renderer_3d.cc
index b437292..8625d31 100644
--- a/remoting/client/plugin/pepper_video_renderer_3d.cc
+++ b/remoting/client/plugin/pepper_video_renderer_3d.cc
@@ -14,8 +14,8 @@
#include "ppapi/cpp/instance.h"
#include "ppapi/lib/gl/include/GLES2/gl2.h"
#include "ppapi/lib/gl/include/GLES2/gl2ext.h"
-#include "remoting/client/chromoting_stats.h"
#include "remoting/proto/video.pb.h"
+#include "remoting/protocol/performance_tracker.h"
#include "remoting/protocol/session_config.h"
namespace remoting {
@@ -187,8 +187,8 @@ void PepperVideoRenderer3D::OnSessionConfig(
<< "video_decoder_.Initialize() returned " << result;
}
-ChromotingStats* PepperVideoRenderer3D::GetStats() {
- return &stats_;
+protocol::PerformanceTracker* PepperVideoRenderer3D::GetPerformanceTracker() {
+ return &perf_tracker_;
}
protocol::VideoStub* PepperVideoRenderer3D::GetVideoStub() {
@@ -199,7 +199,7 @@ void PepperVideoRenderer3D::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
const base::Closure& done) {
base::ScopedClosureRunner done_runner(done);
- stats_.RecordVideoPacketStats(*packet);
+ perf_tracker_.RecordVideoPacketStats(*packet);
// Don't need to do anything if the packet is empty. Host sends empty video
// packets when the screen is not changing.
@@ -344,7 +344,7 @@ void PepperVideoRenderer3D::OnPictureReady(int32_t result,
base::TimeDelta decode_time =
base::TimeTicks::Now() - frame_timer.decode_started_time;
- stats_.RecordDecodeTime(decode_time.InMilliseconds());
+ perf_tracker_.RecordDecodeTime(decode_time.InMilliseconds());
frame_decode_timestamps_.pop_front();
@@ -426,7 +426,7 @@ void PepperVideoRenderer3D::OnPaintDone(int32_t result) {
paint_pending_ = false;
base::TimeDelta paint_time =
base::TimeTicks::Now() - latest_paint_started_time_;
- stats_.RecordPaintTime(paint_time.InMilliseconds());
+ perf_tracker_.RecordPaintTime(paint_time.InMilliseconds());
PaintIfNeeded();
}
diff --git a/remoting/client/plugin/pepper_video_renderer_3d.h b/remoting/client/plugin/pepper_video_renderer_3d.h
index 3e0889f..545ffc5 100644
--- a/remoting/client/plugin/pepper_video_renderer_3d.h
+++ b/remoting/client/plugin/pepper_video_renderer_3d.h
@@ -15,8 +15,8 @@
#include "ppapi/cpp/instance_handle.h"
#include "ppapi/cpp/video_decoder.h"
#include "ppapi/utility/completion_callback_factory.h"
-#include "remoting/client/chromoting_stats.h"
#include "remoting/client/plugin/pepper_video_renderer.h"
+#include "remoting/protocol/performance_tracker.h"
#include "remoting/protocol/video_stub.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
@@ -42,7 +42,7 @@ class PepperVideoRenderer3D : public PepperVideoRenderer,
// VideoRenderer interface.
void OnSessionConfig(const protocol::SessionConfig& config) override;
- ChromotingStats* GetStats() override;
+ protocol::PerformanceTracker* GetPerformanceTracker() override;
protocol::VideoStub* GetVideoStub() override;
// protocol::VideoStub interface.
@@ -107,7 +107,7 @@ class PepperVideoRenderer3D : public PepperVideoRenderer,
webrtc::DesktopSize view_size_;
- ChromotingStats stats_;
+ protocol::PerformanceTracker perf_tracker_;
bool initialization_finished_;
bool decode_pending_;
diff --git a/remoting/client/server_log_entry_client.cc b/remoting/client/server_log_entry_client.cc
index 5d1a1a9..61e1d6c 100644
--- a/remoting/client/server_log_entry_client.cc
+++ b/remoting/client/server_log_entry_client.cc
@@ -9,7 +9,7 @@
#include "base/strings/stringize_macros.h"
#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
-#include "remoting/client/chromoting_stats.h"
+#include "remoting/protocol/performance_tracker.h"
#include "remoting/signaling/server_log_entry.h"
using base::StringPrintf;
@@ -109,23 +109,23 @@ scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
}
scoped_ptr<ServerLogEntry> MakeLogEntryForStatistics(
- ChromotingStats* statistics) {
+ protocol::PerformanceTracker* perf_tracker) {
scoped_ptr<ServerLogEntry> entry(new ServerLogEntry());
entry->AddRoleField(kValueRoleClient);
entry->AddEventNameField(kValueEventNameStatistics);
entry->Set("video-bandwidth",
- StringPrintf("%.2f", statistics->video_bandwidth()));
+ StringPrintf("%.2f", perf_tracker->video_bandwidth()));
entry->Set("capture-latency",
- StringPrintf("%.2f", statistics->video_capture_ms()));
+ StringPrintf("%.2f", perf_tracker->video_capture_ms()));
entry->Set("encode-latency",
- StringPrintf("%.2f", statistics->video_encode_ms()));
+ StringPrintf("%.2f", perf_tracker->video_encode_ms()));
entry->Set("decode-latency",
- StringPrintf("%.2f", statistics->video_decode_ms()));
+ StringPrintf("%.2f", perf_tracker->video_decode_ms()));
entry->Set("render-latency",
- StringPrintf("%.2f", statistics->video_frame_rate()));
+ StringPrintf("%.2f", perf_tracker->video_frame_rate()));
entry->Set("roundtrip-latency",
- StringPrintf("%.2f", statistics->round_trip_ms()));
+ StringPrintf("%.2f", perf_tracker->round_trip_ms()));
return entry.Pass();
}
diff --git a/remoting/client/server_log_entry_client.h b/remoting/client/server_log_entry_client.h
index b2ef262..84c2207 100644
--- a/remoting/client/server_log_entry_client.h
+++ b/remoting/client/server_log_entry_client.h
@@ -11,9 +11,12 @@
namespace remoting {
-class ChromotingStats;
class ServerLogEntry;
+namespace protocol {
+class PerformanceTracker;
+} // namespace protocol
+
// Constructs a log entry for a session state change.
scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
protocol::ConnectionToHost::State state,
@@ -21,7 +24,7 @@ scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
// Constructs a log entry for reporting statistics.
scoped_ptr<ServerLogEntry> MakeLogEntryForStatistics(
- ChromotingStats* statistics);
+ protocol::PerformanceTracker* statistics);
// Constructs a log entry for reporting session ID is old.
scoped_ptr<ServerLogEntry> MakeLogEntryForSessionIdOld(
diff --git a/remoting/client/server_log_entry_client_unittest.cc b/remoting/client/server_log_entry_client_unittest.cc
index 1a39a2e2bb..494f655 100644
--- a/remoting/client/server_log_entry_client_unittest.cc
+++ b/remoting/client/server_log_entry_client_unittest.cc
@@ -5,8 +5,8 @@
#include "base/memory/scoped_ptr.h"
#include "base/strings/stringize_macros.h"
#include "base/sys_info.h"
-#include "remoting/client/chromoting_stats.h"
#include "remoting/client/server_log_entry_client.h"
+#include "remoting/protocol/performance_tracker.h"
#include "remoting/signaling/server_log_entry.h"
#include "remoting/signaling/server_log_entry_unittest.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -49,8 +49,8 @@ TEST(ServerLogEntryClientTest, SessionStateChangeWithError) {
}
TEST(ServerLogEntryClientTest, Statistics) {
- ChromotingStats statistics;
- scoped_ptr<ServerLogEntry> entry(MakeLogEntryForStatistics(&statistics));
+ protocol::PerformanceTracker perf_tracker;
+ scoped_ptr<ServerLogEntry> entry(MakeLogEntryForStatistics(&perf_tracker));
scoped_ptr<XmlElement> stanza = entry->ToStanza();
std::string error;
std::map<std::string, std::string> key_value_pairs;
diff --git a/remoting/client/software_video_renderer.cc b/remoting/client/software_video_renderer.cc
index b1ce27b..835c5ab 100644
--- a/remoting/client/software_video_renderer.cc
+++ b/remoting/client/software_video_renderer.cc
@@ -104,9 +104,9 @@ void SoftwareVideoRenderer::OnSessionConfig(
}
}
-ChromotingStats* SoftwareVideoRenderer::GetStats() {
+protocol::PerformanceTracker* SoftwareVideoRenderer::GetPerformanceTracker() {
DCHECK(thread_checker_.CalledOnValidThread());
- return &stats_;
+ return &perf_tracker_;
}
protocol::VideoStub* SoftwareVideoRenderer::GetVideoStub() {
@@ -120,7 +120,7 @@ void SoftwareVideoRenderer::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
base::ScopedClosureRunner done_runner(done);
- stats_.RecordVideoPacketStats(*packet);
+ perf_tracker_.RecordVideoPacketStats(*packet);
// If the video packet is empty then drop it. Empty packets are used to
// maintain activity on the network.
@@ -166,7 +166,7 @@ void SoftwareVideoRenderer::RenderFrame(
scoped_ptr<webrtc::DesktopFrame> frame) {
DCHECK(thread_checker_.CalledOnValidThread());
- stats_.RecordDecodeTime(
+ perf_tracker_.RecordDecodeTime(
(base::TimeTicks::Now() - decode_start_time).InMilliseconds());
if (!frame) {
@@ -185,7 +185,7 @@ void SoftwareVideoRenderer::OnFrameRendered(base::TimeTicks paint_start_time,
const base::Closure& done) {
DCHECK(thread_checker_.CalledOnValidThread());
- stats_.RecordPaintTime(
+ perf_tracker_.RecordPaintTime(
(base::TimeTicks::Now() - paint_start_time).InMilliseconds());
if (!done.is_null())
diff --git a/remoting/client/software_video_renderer.h b/remoting/client/software_video_renderer.h
index 595d22a..17a7055 100644
--- a/remoting/client/software_video_renderer.h
+++ b/remoting/client/software_video_renderer.h
@@ -9,8 +9,8 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
-#include "remoting/client/chromoting_stats.h"
#include "remoting/client/video_renderer.h"
+#include "remoting/protocol/performance_tracker.h"
#include "remoting/protocol/video_stub.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
@@ -20,14 +20,17 @@ class SingleThreadTaskRunner;
namespace webrtc {
class DesktopFrame;
-} // namespace webrtc;
+} // namespace webrtc
namespace remoting {
-class ChromotingStats;
class FrameConsumer;
class VideoDecoder;
+namespace protocol {
+class PerformanceTracker;
+} // namespace protocol
+
// Implementation of VideoRenderer interface that decodes frame on CPU (on a
// decode thread) and then passes decoded frames to a FrameConsumer.
class SoftwareVideoRenderer : public VideoRenderer,
@@ -44,7 +47,7 @@ class SoftwareVideoRenderer : public VideoRenderer,
// VideoRenderer interface.
void OnSessionConfig(const protocol::SessionConfig& config) override;
- ChromotingStats* GetStats() override;
+ protocol::PerformanceTracker* GetPerformanceTracker() override;
protocol::VideoStub* GetVideoStub() override;
// protocol::VideoStub interface.
@@ -66,7 +69,7 @@ class SoftwareVideoRenderer : public VideoRenderer,
webrtc::DesktopSize source_size_;
webrtc::DesktopVector source_dpi_;
- ChromotingStats stats_;
+ protocol::PerformanceTracker perf_tracker_;
base::ThreadChecker thread_checker_;
diff --git a/remoting/client/video_renderer.h b/remoting/client/video_renderer.h
index 221c824..19e8159c 100644
--- a/remoting/client/video_renderer.h
+++ b/remoting/client/video_renderer.h
@@ -7,9 +7,8 @@
namespace remoting {
-class ChromotingStats;
-
namespace protocol {
+class PerformanceTracker;
class SessionConfig;
class VideoStub;
} // namespace protocol;
@@ -24,8 +23,11 @@ class VideoRenderer {
// exactly once before video data is supplied to the renderer.
virtual void OnSessionConfig(const protocol::SessionConfig& config) = 0;
- // Return the statistics recorded by this client.
- virtual ChromotingStats* GetStats() = 0;
+ // Return the performance tracker.
+ //
+ // TODO(sergeyu): Remove this method. Perf tracker should not be owned by the
+ // renderer.
+ virtual protocol::PerformanceTracker* GetPerformanceTracker() = 0;
// Returns the VideoStub interface of this renderer.
virtual protocol::VideoStub* GetVideoStub() = 0;
diff --git a/remoting/host/cast_extension_session.cc b/remoting/host/cast_extension_session.cc
index 65e003c..9dce746 100644
--- a/remoting/host/cast_extension_session.cc
+++ b/remoting/host/cast_extension_session.cc
@@ -568,8 +568,7 @@ void CastExtensionSession::PollPeerConnectionStats() {
rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> video_track =
stream_->FindVideoTrack(kVideoLabel);
peer_connection_->GetStats(
- stats_observer_,
- video_track.release(),
+ stats_observer_, video_track.release(),
webrtc::PeerConnectionInterface::kStatsOutputLevelStandard);
}
diff --git a/remoting/client/chromoting_stats.cc b/remoting/protocol/performance_tracker.cc
index 4d903e4..b192b56 100644
--- a/remoting/client/chromoting_stats.cc
+++ b/remoting/protocol/performance_tracker.cc
@@ -1,8 +1,9 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "remoting/client/chromoting_stats.h"
+#include "remoting/protocol/performance_tracker.h"
+
#include "remoting/proto/video.pb.h"
namespace {
@@ -52,11 +53,13 @@ const int kBandwidthHistogramBuckets = 100;
// bursts of packets. Enum histograms expect samples to be less than the
// boundary value, so set to 101.
const int kMaxFramesPerSec = 101;
+
} // namespace
namespace remoting {
+namespace protocol {
-ChromotingStats::ChromotingStats()
+PerformanceTracker::PerformanceTracker()
: video_bandwidth_(
base::TimeDelta::FromSeconds(kStatsUpdateFrequencyInSeconds)),
video_frame_rate_(
@@ -69,10 +72,10 @@ ChromotingStats::ChromotingStats()
video_paint_ms_(kLatencySampleSize),
round_trip_ms_(kLatencySampleSize) {}
-ChromotingStats::~ChromotingStats() {
+PerformanceTracker::~PerformanceTracker() {
}
-void ChromotingStats::SetUpdateUmaCallbacks(
+void PerformanceTracker::SetUpdateUmaCallbacks(
UpdateUmaCustomHistogramCallback update_uma_custom_counts_callback,
UpdateUmaCustomHistogramCallback update_uma_custom_times_callback,
UpdateUmaEnumHistogramCallback update_uma_enum_histogram_callback) {
@@ -81,7 +84,7 @@ void ChromotingStats::SetUpdateUmaCallbacks(
uma_enum_histogram_updater_ = update_uma_enum_histogram_callback;
}
-void ChromotingStats::RecordVideoPacketStats(const VideoPacket& packet) {
+void PerformanceTracker::RecordVideoPacketStats(const VideoPacket& packet) {
// Record this received packet, even if it is empty.
video_packet_rate_.Record(1);
@@ -130,7 +133,7 @@ void ChromotingStats::RecordVideoPacketStats(const VideoPacket& packet) {
}
}
-void ChromotingStats::RecordDecodeTime(double value) {
+void PerformanceTracker::RecordDecodeTime(double value) {
video_decode_ms_.Record(value);
if (!uma_custom_times_updater_.is_null())
uma_custom_times_updater_.Run(
@@ -138,7 +141,7 @@ void ChromotingStats::RecordDecodeTime(double value) {
kVideoActionsHistogramsMaxMs, kVideoActionsHistogramsBuckets);
}
-void ChromotingStats::RecordPaintTime(double value) {
+void PerformanceTracker::RecordPaintTime(double value) {
video_paint_ms_.Record(value);
if (!uma_custom_times_updater_.is_null())
uma_custom_times_updater_.Run(
@@ -146,7 +149,7 @@ void ChromotingStats::RecordPaintTime(double value) {
kVideoActionsHistogramsMaxMs, kVideoActionsHistogramsBuckets);
}
-void ChromotingStats::UploadRateStatsToUma() {
+void PerformanceTracker::UploadRateStatsToUma() {
if (!uma_enum_histogram_updater_.is_null()) {
uma_enum_histogram_updater_.Run(kVideoFrameRateHistogram,
video_frame_rate(), kMaxFramesPerSec);
@@ -158,4 +161,5 @@ void ChromotingStats::UploadRateStatsToUma() {
}
}
+} // namespace protocol
} // namespace remoting
diff --git a/remoting/client/chromoting_stats.h b/remoting/protocol/performance_tracker.h
index 5e8a93b..e6c33f4 100644
--- a/remoting/client/chromoting_stats.h
+++ b/remoting/protocol/performance_tracker.h
@@ -1,12 +1,9 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// ChromotingStats defines a bundle of performance counters and statistics
-// for chromoting.
-
-#ifndef REMOTING_CLIENT_CHROMOTING_STATS_H_
-#define REMOTING_CLIENT_CHROMOTING_STATS_H_
+#ifndef REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
+#define REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
#include "base/callback.h"
#include "remoting/base/rate_counter.h"
@@ -16,7 +13,11 @@ namespace remoting {
class VideoPacket;
-class ChromotingStats {
+namespace protocol {
+
+// PerformanceTracker defines a bundle of performance counters and statistics
+// for chromoting.
+class PerformanceTracker {
public:
// Callback that updates UMA custom counts or custom times histograms.
typedef base::Callback<void(const std::string& histogram_name,
@@ -31,8 +32,8 @@ class ChromotingStats {
void(const std::string& histogram_name, int64 value, int histogram_max)>
UpdateUmaEnumHistogramCallback;
- ChromotingStats();
- virtual ~ChromotingStats();
+ PerformanceTracker();
+ virtual ~PerformanceTracker();
// Constant used to calculate the average for rate metrics and used by the
// plugin for the frequency at which stats should be updated.
@@ -96,9 +97,10 @@ class ChromotingStats {
// The latest input timestamp that a VideoPacket was seen annotated with.
int64 latest_input_event_timestamp_ = 0;
- DISALLOW_COPY_AND_ASSIGN(ChromotingStats);
+ DISALLOW_COPY_AND_ASSIGN(PerformanceTracker);
};
+} // namespace protocol
} // namespace remoting
-#endif // REMOTING_CLIENT_CHROMOTING_STATS_H_
+#endif // REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
diff --git a/remoting/remoting_srcs.gypi b/remoting/remoting_srcs.gypi
index 60c77b5..dc5d7c7 100644
--- a/remoting/remoting_srcs.gypi
+++ b/remoting/remoting_srcs.gypi
@@ -168,6 +168,8 @@
'protocol/pairing_host_authenticator.h',
'protocol/pairing_registry.cc',
'protocol/pairing_registry.h',
+ 'protocol/performance_tracker.cc',
+ 'protocol/performance_tracker.h',
'protocol/port_range.cc',
'protocol/port_range.h',
'protocol/pseudotcp_adapter.cc',
@@ -233,8 +235,6 @@
'client/audio_player.h',
'client/chromoting_client.cc',
'client/chromoting_client.h',
- 'client/chromoting_stats.cc',
- 'client/chromoting_stats.h',
'client/client_context.cc',
'client/client_context.h',
'client/client_status_logger.cc',
diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc
index c9356c5..225d1f1 100644
--- a/remoting/test/protocol_perftest.cc
+++ b/remoting/test/protocol_perftest.cc
@@ -119,7 +119,9 @@ class ProtocolPerfTest
// VideoRenderer interface.
void OnSessionConfig(const protocol::SessionConfig& config) override {}
- ChromotingStats* GetStats() override { return nullptr; }
+ protocol::PerformanceTracker* GetPerformanceTracker() override {
+ return nullptr;
+ }
protocol::VideoStub* GetVideoStub() override { return this; }
// protocol::VideoStub interface.
diff --git a/remoting/test/test_video_renderer.cc b/remoting/test/test_video_renderer.cc
index a2cfe3f..040ea69 100644
--- a/remoting/test/test_video_renderer.cc
+++ b/remoting/test/test_video_renderer.cc
@@ -300,10 +300,10 @@ void TestVideoRenderer::OnSessionConfig(const protocol::SessionConfig& config) {
SetCodecForDecoding(codec);
}
-ChromotingStats* TestVideoRenderer::GetStats() {
+protocol::PerformanceTracker* TestVideoRenderer::GetPerformanceTracker() {
DCHECK(thread_checker_.CalledOnValidThread());
- VLOG(2) << "TestVideoRenderer::GetStats() Called";
+ VLOG(2) << "TestVideoRenderer::GetPerformanceTracker() Called";
return nullptr;
}
diff --git a/remoting/test/test_video_renderer.h b/remoting/test/test_video_renderer.h
index 9271570..ea4c068 100644
--- a/remoting/test/test_video_renderer.h
+++ b/remoting/test/test_video_renderer.h
@@ -38,7 +38,7 @@ class TestVideoRenderer : public VideoRenderer, public protocol::VideoStub {
// VideoRenderer interface.
void OnSessionConfig(const protocol::SessionConfig& config) override;
- ChromotingStats* GetStats() override;
+ protocol::PerformanceTracker* GetPerformanceTracker() override;
protocol::VideoStub* GetVideoStub() override;
// protocol::VideoStub interface.