OLD | NEW |
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 #ifndef MEDIA_CAST_LOGGING_LOGGING_STATS_H_ | 5 #ifndef MEDIA_CAST_LOGGING_LOGGING_STATS_H_ |
6 #define MEDIA_CAST_LOGGING_LOGGING_STATS_H_ | 6 #define MEDIA_CAST_LOGGING_LOGGING_STATS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/time/tick_clock.h" | 9 #include "base/time/tick_clock.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "media/cast/logging/logging_defines.h" | 11 #include "media/cast/logging/logging_defines.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 namespace cast { | 14 namespace cast { |
15 | 15 |
16 const int kNumberOfEvents = 19; | |
17 | |
18 class LoggingStats { | 16 class LoggingStats { |
19 public: | 17 public: |
20 explicit LoggingStats(base::TickClock* clock); | 18 explicit LoggingStats(base::TickClock* clock); |
21 | 19 |
22 ~LoggingStats(); | 20 ~LoggingStats(); |
23 | 21 |
24 void Reset(); | 22 void Reset(); |
25 | 23 |
26 void InsertFrameEvent(CastLoggingEvent event, | 24 void InsertFrameEvent(CastLoggingEvent event, |
27 uint32 rtp_timestamp, | 25 uint32 rtp_timestamp, |
28 uint32 frame_id); | 26 uint32 frame_id); |
29 | 27 |
30 void InsertFrameEventWithSize(CastLoggingEvent event, | 28 void InsertFrameEventWithSize(CastLoggingEvent event, |
31 uint32 rtp_timestamp, | 29 uint32 rtp_timestamp, |
32 uint32 frame_id, | 30 uint32 frame_id, |
33 int frame_size); | 31 int frame_size); |
34 | 32 |
35 void InsertFrameEventWithDelay(CastLoggingEvent event, | 33 void InsertFrameEventWithDelay(CastLoggingEvent event, |
36 uint32 rtp_timestamp, | 34 uint32 rtp_timestamp, |
37 uint32 frame_id, | 35 uint32 frame_id, |
38 base::TimeDelta delay); | 36 base::TimeDelta delay); |
39 | 37 |
40 void InsertPacketEvent(CastLoggingEvent event, | 38 void InsertPacketEvent(CastLoggingEvent event, |
41 uint32 rtp_timestamp, | 39 uint32 rtp_timestamp, |
42 uint32 frame_id, | 40 uint32 frame_id, |
43 uint16 packet_id, | 41 uint16 packet_id, |
44 uint16 max_packet_id, | 42 uint16 max_packet_id, |
45 int size); | 43 size_t size); |
46 | 44 |
47 void InsertGenericEvent(CastLoggingEvent event, int value); | 45 void InsertGenericEvent(CastLoggingEvent event, int value); |
48 | 46 |
49 // Get log stats: some of the values, such as frame rate and bit rates are | 47 // Get log stats: some of the values, such as frame rate and bit rates are |
50 // computed at the time of the call. | 48 // computed at the time of the call. |
51 const FrameStatsMap* GetFrameStatsData(); | 49 const FrameStatsMap* GetFrameStatsData(); |
52 | 50 |
53 const PacketStatsMap* GetPacketStatsData(); | 51 const PacketStatsMap* GetPacketStatsData(); |
54 | 52 |
55 const GenericStatsMap* GetGenericStatsData(); | 53 const GenericStatsMap* GetGenericStatsData(); |
56 | 54 |
57 private: | 55 private: |
58 void InsertBaseFrameEvent(CastLoggingEvent event, | 56 void InsertBaseFrameEvent(CastLoggingEvent event, |
59 uint32 frame_id, | 57 uint32 frame_id, |
60 uint32 rtp_timestamp); | 58 uint32 rtp_timestamp); |
61 FrameStatsMap frame_stats_; | 59 FrameStatsMap frame_stats_; |
62 PacketStatsMap packet_stats_; | 60 PacketStatsMap packet_stats_; |
63 GenericStatsMap generic_stats_; | 61 GenericStatsMap generic_stats_; |
64 // Every event has an individual start time | 62 // Every event has an individual start time |
65 base::TimeTicks start_time_[kNumberOfEvents]; | 63 base::TimeTicks start_time_[kNumOfLoggingEvents]; |
66 // Keep track of event counts. | 64 // Keep track of event counts. |
67 int counts_[kNumberOfEvents]; | 65 int counts_[kNumOfLoggingEvents]; |
68 base::TickClock* const clock_; // Not owned by this class. | 66 base::TickClock* const clock_; // Not owned by this class. |
69 | 67 |
70 DISALLOW_COPY_AND_ASSIGN(LoggingStats); | 68 DISALLOW_COPY_AND_ASSIGN(LoggingStats); |
71 }; | 69 }; |
72 | 70 |
73 } // namespace cast | 71 } // namespace cast |
74 } // namespace media | 72 } // namespace media |
75 | 73 |
76 #endif // MEDIA_CAST_LOGGING_LOGGING_STATS_H_ | 74 #endif // MEDIA_CAST_LOGGING_LOGGING_STATS_H_ |
77 | 75 |
OLD | NEW |