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

Side by Side Diff: cc/debug/rendering_stats_instrumentation.h

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « cc/debug/rendering_stats.cc ('k') | cc/debug/rendering_stats_instrumentation.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 #ifndef CC_DEBUG_RENDERING_STATS_INSTRUMENTATION_H_ 5 #ifndef CC_DEBUG_RENDERING_STATS_INSTRUMENTATION_H_
6 #define CC_DEBUG_RENDERING_STATS_INSTRUMENTATION_H_ 6 #define CC_DEBUG_RENDERING_STATS_INSTRUMENTATION_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "cc/debug/rendering_stats.h" 10 #include "cc/debug/rendering_stats.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 // RenderingStatsInstrumentation is shared among threads and manages conditional 14 // RenderingStatsInstrumentation is shared among threads and manages conditional
15 // recording of rendering stats into a private RenderingStats instance. 15 // recording of rendering stats into a private RenderingStats instance.
16 class CC_EXPORT RenderingStatsInstrumentation { 16 class CC_EXPORT RenderingStatsInstrumentation {
17 public: 17 public:
18 static scoped_ptr<RenderingStatsInstrumentation> Create(); 18 static scoped_ptr<RenderingStatsInstrumentation> Create();
19 virtual ~RenderingStatsInstrumentation(); 19 virtual ~RenderingStatsInstrumentation();
20 20
21 // Return copy of current main thread rendering stats.
22 RenderingStats::MainThreadRenderingStats main_thread_rendering_stats();
23
24 // Return copy of current impl thread rendering stats. 21 // Return copy of current impl thread rendering stats.
25 RenderingStats::ImplThreadRenderingStats impl_thread_rendering_stats(); 22 RenderingStats impl_thread_rendering_stats();
26 23
27 // Return the accumulated, combined rendering stats. 24 // Return the accumulated, combined rendering stats.
28 RenderingStats GetRenderingStats(); 25 RenderingStats GetRenderingStats();
29 26
30 // Add current main thread rendering stats to accumulator and
31 // clear current stats.
32 void AccumulateAndClearMainThreadStats();
33
34 // Add current impl thread rendering stats to accumulator and 27 // Add current impl thread rendering stats to accumulator and
35 // clear current stats. 28 // clear current stats.
36 void AccumulateAndClearImplThreadStats(); 29 void AccumulateAndClearImplThreadStats();
37 30
38 // Read and write access to the record_rendering_stats_ flag is not locked to 31 // Read and write access to the record_rendering_stats_ flag is not locked to
39 // improve performance. The flag is commonly turned off and hardly changes 32 // improve performance. The flag is commonly turned off and hardly changes
40 // it's value during runtime. 33 // it's value during runtime.
41 bool record_rendering_stats() const { return record_rendering_stats_; } 34 bool record_rendering_stats() const { return record_rendering_stats_; }
42 void set_record_rendering_stats(bool record_rendering_stats) { 35 void set_record_rendering_stats(bool record_rendering_stats) {
43 if (record_rendering_stats_ != record_rendering_stats) 36 if (record_rendering_stats_ != record_rendering_stats)
44 record_rendering_stats_ = record_rendering_stats; 37 record_rendering_stats_ = record_rendering_stats;
45 } 38 }
46 39
47 base::TimeTicks StartRecording() const; 40 base::TimeTicks StartRecording() const;
48 base::TimeDelta EndRecording(base::TimeTicks start_time) const; 41 base::TimeDelta EndRecording(base::TimeTicks start_time) const;
49 42
50 void IncrementFrameCount(int64 count); 43 void IncrementFrameCount(int64 count);
51 void AddPaint(base::TimeDelta duration, int64 pixels);
52 void AddRecord(base::TimeDelta duration, int64 pixels);
53 void AddVisibleContentArea(int64 area); 44 void AddVisibleContentArea(int64 area);
54 void AddApproximatedVisibleContentArea(int64 area); 45 void AddApproximatedVisibleContentArea(int64 area);
55 void AddDrawDuration(base::TimeDelta draw_duration, 46 void AddDrawDuration(base::TimeDelta draw_duration,
56 base::TimeDelta draw_duration_estimate); 47 base::TimeDelta draw_duration_estimate);
57 void AddBeginMainFrameToCommitDuration( 48 void AddBeginMainFrameToCommitDuration(
58 base::TimeDelta begin_main_frame_to_commit_duration, 49 base::TimeDelta begin_main_frame_to_commit_duration,
59 base::TimeDelta begin_main_frame_to_commit_duration_estimate); 50 base::TimeDelta begin_main_frame_to_commit_duration_estimate);
60 void AddCommitToActivateDuration( 51 void AddCommitToActivateDuration(
61 base::TimeDelta commit_to_activate_duration, 52 base::TimeDelta commit_to_activate_duration,
62 base::TimeDelta commit_to_activate_duration_estimate); 53 base::TimeDelta commit_to_activate_duration_estimate);
63 54
64 protected: 55 protected:
65 RenderingStatsInstrumentation(); 56 RenderingStatsInstrumentation();
66 57
67 private: 58 private:
68 RenderingStats::MainThreadRenderingStats main_thread_rendering_stats_; 59 RenderingStats impl_thread_rendering_stats_;
69 RenderingStats::MainThreadRenderingStats main_thread_rendering_stats_accu_; 60 RenderingStats impl_thread_rendering_stats_accu_;
70 RenderingStats::ImplThreadRenderingStats impl_thread_rendering_stats_;
71 RenderingStats::ImplThreadRenderingStats impl_thread_rendering_stats_accu_;
72 61
73 bool record_rendering_stats_; 62 bool record_rendering_stats_;
74 63
75 base::Lock lock_; 64 base::Lock lock_;
76 65
77 DISALLOW_COPY_AND_ASSIGN(RenderingStatsInstrumentation); 66 DISALLOW_COPY_AND_ASSIGN(RenderingStatsInstrumentation);
78 }; 67 };
79 68
80 } // namespace cc 69 } // namespace cc
81 70
82 #endif // CC_DEBUG_RENDERING_STATS_INSTRUMENTATION_H_ 71 #endif // CC_DEBUG_RENDERING_STATS_INSTRUMENTATION_H_
OLDNEW
« no previous file with comments | « cc/debug/rendering_stats.cc ('k') | cc/debug/rendering_stats_instrumentation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698