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

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

Issue 236123003: Cast: Provide more meaningful stats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile Created 6 years, 7 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 | « media/cast/logging/stats_util.h ('k') | media/cast/test/fake_receiver_time_offset_estimator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/cast/logging/stats_util.h"
6
7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h"
10
11 namespace media {
12 namespace cast {
13
14 scoped_ptr<base::DictionaryValue> ConvertStats(
15 const FrameStatsMap& frame_stats_map,
16 const PacketStatsMap& packet_stats_map) {
17 scoped_ptr<base::DictionaryValue> overall_stats(new base::DictionaryValue);
18
19 scoped_ptr<base::DictionaryValue> overall_frame_stats(
20 new base::DictionaryValue);
21 for (FrameStatsMap::const_iterator it = frame_stats_map.begin();
22 it != frame_stats_map.end();
23 ++it) {
24 scoped_ptr<base::DictionaryValue> frame_stats(new base::DictionaryValue);
25
26 frame_stats->SetDouble("firstEventTime",
27 it->second.first_event_time.ToInternalValue());
28 frame_stats->SetDouble("lastEventTime",
29 it->second.last_event_time.ToInternalValue());
30 frame_stats->SetInteger("count", it->second.event_counter);
31 frame_stats->SetInteger("sizeTotal", static_cast<int>(it->second.sum_size));
32 frame_stats->SetInteger("minDelayMs",
33 it->second.min_delay.InMilliseconds());
34 frame_stats->SetInteger("maxDelayMs",
35 it->second.max_delay.InMilliseconds());
36 frame_stats->SetInteger("sumDelayMs",
37 it->second.sum_delay.InMilliseconds());
38
39 overall_frame_stats->Set(CastLoggingToString(it->first),
40 frame_stats.release());
41 }
42
43 overall_stats->Set("frameStats", overall_frame_stats.release());
44
45 scoped_ptr<base::DictionaryValue> overall_packet_stats(
46 new base::DictionaryValue);
47 for (PacketStatsMap::const_iterator it = packet_stats_map.begin();
48 it != packet_stats_map.end();
49 ++it) {
50 scoped_ptr<base::DictionaryValue> packet_stats(new base::DictionaryValue);
51
52 packet_stats->SetDouble("firstEventTime",
53 it->second.first_event_time.ToInternalValue());
54 packet_stats->SetDouble("lastEventTime",
55 it->second.last_event_time.ToInternalValue());
56 packet_stats->SetDouble("lastEventTime",
57 it->second.last_event_time.ToInternalValue());
58 packet_stats->SetInteger("count", it->second.event_counter);
59 packet_stats->SetInteger("sizeTotal",
60 static_cast<int>(it->second.sum_size));
61
62 overall_packet_stats->Set(CastLoggingToString(it->first),
63 packet_stats.release());
64 }
65
66 overall_stats->Set("packetStats", overall_packet_stats.release());
67
68 return overall_stats.Pass();
69 }
70
71 } // namespace cast
72 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/logging/stats_util.h ('k') | media/cast/test/fake_receiver_time_offset_estimator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698