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

Side by Side Diff: media/cast/logging/logging_stats.cc

Issue 134843005: Cast:Updating logging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Responding to review and removing unused files Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « media/cast/logging/logging_raw.cc ('k') | media/cast/logging/logging_unittest.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 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 "base/memory/linked_ptr.h" 5 #include "base/memory/linked_ptr.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "media/cast/logging/logging_stats.h" 7 #include "media/cast/logging/logging_stats.h"
8 8
9 namespace media { 9 namespace media {
10 namespace cast { 10 namespace cast {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 const FrameStatsMap* LoggingStats::GetFrameStatsData( 121 const FrameStatsMap* LoggingStats::GetFrameStatsData(
122 const base::TimeTicks& now) { 122 const base::TimeTicks& now) {
123 // Compute framerate and bitrate (when available). 123 // Compute framerate and bitrate (when available).
124 FrameStatsMap::iterator it; 124 FrameStatsMap::iterator it;
125 for (it = frame_stats_.begin(); it != frame_stats_.end(); ++it) { 125 for (it = frame_stats_.begin(); it != frame_stats_.end(); ++it) {
126 base::TimeDelta time_diff = now - start_time_[it->first]; 126 base::TimeDelta time_diff = now - start_time_[it->first];
127 it->second->framerate_fps = counts_[it->first] / time_diff.InSecondsF(); 127 it->second->framerate_fps = counts_[it->first] / time_diff.InSecondsF();
128 if (it->second->bitrate_kbps > 0) { 128 if (it->second->bitrate_kbps > 0) {
129 it->second->bitrate_kbps = (8 / 1000) * 129 it->second->bitrate_kbps = (8 / 1000) * it->second->bitrate_kbps /
130 it->second->bitrate_kbps / time_diff.InSecondsF(); 130 time_diff.InSecondsF();
131 } 131 }
132 if (it->second->avg_delay_ms > 0) 132 if (it->second->avg_delay_ms > 0)
133 it->second->avg_delay_ms /= counts_[it->first]; 133 it->second->avg_delay_ms /= counts_[it->first];
134 } 134 }
135 return &frame_stats_; 135 return &frame_stats_;
136 } 136 }
137 137
138 const PacketStatsMap* LoggingStats::GetPacketStatsData( 138 const PacketStatsMap* LoggingStats::GetPacketStatsData(
139 const base::TimeTicks& now) { 139 const base::TimeTicks& now) {
140 PacketStatsMap::iterator it; 140 PacketStatsMap::iterator it;
141 for (it = packet_stats_.begin(); it != packet_stats_.end(); ++it) { 141 for (it = packet_stats_.begin(); it != packet_stats_.end(); ++it) {
142 if (counts_[it->first] == 0) continue; 142 if (counts_[it->first] == 0) continue;
143 base::TimeDelta time_diff = now - start_time_[it->first]; 143 base::TimeDelta time_diff = now - start_time_[it->first];
144 it->second = (8 / 1000) * it->second / time_diff.InSecondsF(); 144 it->second = (8 / 1000) * it->second / time_diff.InSecondsF();
145 } 145 }
146 return &packet_stats_; 146 return &packet_stats_;
147 } 147 }
148 148
149 const GenericStatsMap* LoggingStats::GetGenericStatsData() { 149 const GenericStatsMap* LoggingStats::GetGenericStatsData() {
150 // Compute averages. 150 // Compute averages.
151 GenericStatsMap::iterator it; 151 GenericStatsMap::iterator it;
152 for (it = generic_stats_.begin(); it != generic_stats_.end(); ++it) { 152 for (it = generic_stats_.begin(); it != generic_stats_.end(); ++it) {
153 it->second /= counts_[ it->first]; 153 it->second /= counts_[ it->first];
154 } 154 }
155 return &generic_stats_; 155 return &generic_stats_;
156 } 156 }
157 157
158 } // namespace cast 158 } // namespace cast
159 } // namespace media 159 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/logging/logging_raw.cc ('k') | media/cast/logging/logging_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698