OLD | NEW |
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 CC_DEBUG_FRAME_TIMING_TRACKER_H_ | 5 #ifndef CC_DEBUG_FRAME_TIMING_TRACKER_H_ |
6 #define CC_DEBUG_FRAME_TIMING_TRACKER_H_ | 6 #define CC_DEBUG_FRAME_TIMING_TRACKER_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 CompositeTimingEvent(int, base::TimeTicks); | 25 CompositeTimingEvent(int, base::TimeTicks); |
26 ~CompositeTimingEvent(); | 26 ~CompositeTimingEvent(); |
27 | 27 |
28 int frame_id; | 28 int frame_id; |
29 base::TimeTicks timestamp; | 29 base::TimeTicks timestamp; |
30 }; | 30 }; |
31 | 31 |
32 using CompositeTimingSet = | 32 using CompositeTimingSet = |
33 base::hash_map<int, std::vector<CompositeTimingEvent>>; | 33 base::hash_map<int, std::vector<CompositeTimingEvent>>; |
34 | 34 |
| 35 struct CC_EXPORT MainFrameTimingEvent { |
| 36 MainFrameTimingEvent(int frame_id, |
| 37 base::TimeTicks timestamp, |
| 38 base::TimeTicks end_time); |
| 39 ~MainFrameTimingEvent(); |
| 40 |
| 41 int frame_id; |
| 42 base::TimeTicks timestamp; |
| 43 base::TimeTicks end_time; |
| 44 }; |
| 45 |
| 46 using MainFrameTimingSet = |
| 47 base::hash_map<int, std::vector<MainFrameTimingEvent>>; |
| 48 |
35 static scoped_ptr<FrameTimingTracker> Create(); | 49 static scoped_ptr<FrameTimingTracker> Create(); |
36 | 50 |
37 ~FrameTimingTracker(); | 51 ~FrameTimingTracker(); |
38 | 52 |
39 // This routine takes all of the individual CompositeEvents stored in the | 53 // This routine takes all of the individual CompositeEvents stored in the |
40 // tracker and collects them by "rect_id", as in the example below. | 54 // tracker and collects them by "rect_id", as in the example below. |
41 // [ {f_id1,r_id1,t1}, {f_id2,r_id1,t2}, {f_id3,r_id2,t3} ] | 55 // [ {f_id1,r_id1,t1}, {f_id2,r_id1,t2}, {f_id3,r_id2,t3} ] |
42 // ====> | 56 // ====> |
43 // [ {r_id1,<{f_id1,t1},{f_id2,t2}>}, {r_id2,<{f_id3,t3}>} ] | 57 // [ {r_id1,<{f_id1,t1},{f_id2,t2}>}, {r_id2,<{f_id3,t3}>} ] |
44 scoped_ptr<CompositeTimingSet> GroupCountsByRectId(); | 58 scoped_ptr<CompositeTimingSet> GroupCompositeCountsByRectId(); |
| 59 |
| 60 // This routine takes all of the individual MainFrameEvents stored in the |
| 61 // tracker and collects them by "rect_id", as in the example below. |
| 62 scoped_ptr<MainFrameTimingSet> GroupMainFrameCountsByRectId(); |
45 | 63 |
46 // This routine takes a timestamp and an array of frame_id,rect_id pairs | 64 // This routine takes a timestamp and an array of frame_id,rect_id pairs |
47 // and generates CompositeTimingEvents (frame_id, timestamp) and adds them to | 65 // and generates CompositeTimingEvents (frame_id, timestamp) and adds them to |
48 // internal hash_map keyed on rect_id | 66 // internal hash_map keyed on rect_id |
49 using FrameAndRectIds = std::pair<int, int64_t>; | 67 using FrameAndRectIds = std::pair<int, int64_t>; |
50 void SaveTimeStamps(base::TimeTicks timestamp, | 68 void SaveTimeStamps(base::TimeTicks timestamp, |
51 const std::vector<FrameAndRectIds>& frame_ids); | 69 const std::vector<FrameAndRectIds>& frame_ids); |
52 | 70 |
| 71 void SaveMainFrameTimeStamps(const std::vector<int64_t>& request_ids, |
| 72 base::TimeTicks main_frame_time, |
| 73 base::TimeTicks end_time, |
| 74 int source_frame_number); |
| 75 |
53 private: | 76 private: |
54 FrameTimingTracker(); | 77 FrameTimingTracker(); |
55 | 78 |
56 scoped_ptr<CompositeTimingSet> composite_events_; | 79 scoped_ptr<CompositeTimingSet> composite_events_; |
| 80 scoped_ptr<MainFrameTimingSet> main_frame_events_; |
57 | 81 |
58 DISALLOW_COPY_AND_ASSIGN(FrameTimingTracker); | 82 DISALLOW_COPY_AND_ASSIGN(FrameTimingTracker); |
59 }; | 83 }; |
60 | 84 |
61 } // namespace cc | 85 } // namespace cc |
62 | 86 |
63 #endif // CC_DEBUG_FRAME_TIMING_TRACKER_H_ | 87 #endif // CC_DEBUG_FRAME_TIMING_TRACKER_H_ |
OLD | NEW |