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

Side by Side Diff: remoting/protocol/performance_tracker.h

Issue 2113523007: More cleanups in FrameStats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android Created 4 years, 5 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
« no previous file with comments | « remoting/protocol/frame_stats.cc ('k') | remoting/protocol/performance_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_ 5 #ifndef REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
6 #define REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_ 6 #define REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "remoting/base/rate_counter.h" 13 #include "remoting/base/rate_counter.h"
14 #include "remoting/base/running_samples.h" 14 #include "remoting/base/running_samples.h"
15 #include "remoting/protocol/frame_stats.h"
15 16
16 namespace remoting { 17 namespace remoting {
17 namespace protocol { 18 namespace protocol {
18 19
19 struct FrameStats;
20
21 // PerformanceTracker defines a bundle of performance counters and statistics 20 // PerformanceTracker defines a bundle of performance counters and statistics
22 // for chromoting. 21 // for chromoting.
23 class PerformanceTracker { 22 class PerformanceTracker : public FrameStatsConsumer {
24 public: 23 public:
25 // Callback that updates UMA custom counts or custom times histograms. 24 // Callback that updates UMA custom counts or custom times histograms.
26 typedef base::Callback<void(const std::string& histogram_name, 25 typedef base::Callback<void(const std::string& histogram_name,
27 int64_t value, 26 int64_t value,
28 int histogram_min, 27 int histogram_min,
29 int histogram_max, 28 int histogram_max,
30 int histogram_buckets)> 29 int histogram_buckets)>
31 UpdateUmaCustomHistogramCallback; 30 UpdateUmaCustomHistogramCallback;
32 31
33 // Callback that updates UMA enumeration histograms. 32 // Callback that updates UMA enumeration histograms.
34 typedef base::Callback< 33 typedef base::Callback<
35 void(const std::string& histogram_name, int64_t value, int histogram_max)> 34 void(const std::string& histogram_name, int64_t value, int histogram_max)>
36 UpdateUmaEnumHistogramCallback; 35 UpdateUmaEnumHistogramCallback;
37 36
38 PerformanceTracker(); 37 PerformanceTracker();
39 virtual ~PerformanceTracker(); 38 ~PerformanceTracker() override;
40 39
41 // Constant used to calculate the average for rate metrics and used by the 40 // Constant used to calculate the average for rate metrics and used by the
42 // plugin for the frequency at which stats should be updated. 41 // plugin for the frequency at which stats should be updated.
43 static const int kStatsUpdatePeriodSeconds = 1; 42 static const int kStatsUpdatePeriodSeconds = 1;
44 43
45 // Return rates and running-averages for different metrics. 44 // Return rates and running-averages for different metrics.
46 double video_bandwidth() { return video_bandwidth_.Rate(); } 45 double video_bandwidth() { return video_bandwidth_.Rate(); }
47 double video_frame_rate() { return video_frame_rate_.Rate(); } 46 double video_frame_rate() { return video_frame_rate_.Rate(); }
48 double video_packet_rate() { return video_packet_rate_.Rate(); } 47 double video_packet_rate() { return video_packet_rate_.Rate(); }
49 const RunningSamples& video_capture_ms() { return video_capture_ms_; } 48 const RunningSamples& video_capture_ms() { return video_capture_ms_; }
50 const RunningSamples& video_encode_ms() { return video_encode_ms_; } 49 const RunningSamples& video_encode_ms() { return video_encode_ms_; }
51 const RunningSamples& video_decode_ms() { return video_decode_ms_; } 50 const RunningSamples& video_decode_ms() { return video_decode_ms_; }
52 const RunningSamples& video_paint_ms() { return video_paint_ms_; } 51 const RunningSamples& video_paint_ms() { return video_paint_ms_; }
53 const RunningSamples& round_trip_ms() { return round_trip_ms_; } 52 const RunningSamples& round_trip_ms() { return round_trip_ms_; }
54 53
55 // Record stats for a video-packet. 54 // FrameStatsConsumer interface.
56 void RecordVideoFrameStats(const FrameStats& stats); 55 void OnVideoFrameStats(const FrameStats& stats) override;
57 56
58 // Sets callbacks in ChromotingInstance to update a UMA custom counts, custom 57 // Sets callbacks in ChromotingInstance to update a UMA custom counts, custom
59 // times or enum histogram. 58 // times or enum histogram.
60 void SetUpdateUmaCallbacks( 59 void SetUpdateUmaCallbacks(
61 UpdateUmaCustomHistogramCallback update_uma_custom_counts_callback, 60 UpdateUmaCustomHistogramCallback update_uma_custom_counts_callback,
62 UpdateUmaCustomHistogramCallback update_uma_custom_times_callback, 61 UpdateUmaCustomHistogramCallback update_uma_custom_times_callback,
63 UpdateUmaEnumHistogramCallback update_uma_enum_histogram_callback); 62 UpdateUmaEnumHistogramCallback update_uma_enum_histogram_callback);
64 63
65 void OnPauseStateChanged(bool paused); 64 void OnPauseStateChanged(bool paused);
66 65
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 99
101 base::RepeatingTimer upload_uma_stats_timer_; 100 base::RepeatingTimer upload_uma_stats_timer_;
102 101
103 DISALLOW_COPY_AND_ASSIGN(PerformanceTracker); 102 DISALLOW_COPY_AND_ASSIGN(PerformanceTracker);
104 }; 103 };
105 104
106 } // namespace protocol 105 } // namespace protocol
107 } // namespace remoting 106 } // namespace remoting
108 107
109 #endif // REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_ 108 #endif // REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
OLDNEW
« no previous file with comments | « remoting/protocol/frame_stats.cc ('k') | remoting/protocol/performance_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698