OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains the GPUTrace class. | 5 // This file contains the GPUTrace class. |
6 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 6 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
7 #define GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 7 #define GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 bool Begin(const std::string& category, const std::string& name, | 82 bool Begin(const std::string& category, const std::string& name, |
83 GpuTracerSource source); | 83 GpuTracerSource source); |
84 | 84 |
85 // End the last started trace marker. | 85 // End the last started trace marker. |
86 bool End(GpuTracerSource source); | 86 bool End(GpuTracerSource source); |
87 | 87 |
88 virtual bool IsTracing(); | 88 virtual bool IsTracing(); |
89 | 89 |
90 // Retrieve the name of the current open trace. | 90 // Retrieve the name of the current open trace. |
91 // Returns empty string if no current open trace. | 91 // Returns empty string if no current open trace. |
92 const std::string& CurrentCategory() const; | 92 const std::string& CurrentCategory(GpuTracerSource source) const; |
93 const std::string& CurrentName() const; | 93 const std::string& CurrentName(GpuTracerSource source) const; |
94 | 94 |
95 protected: | 95 protected: |
96 // Trace Processing. | 96 // Trace Processing. |
97 scoped_refptr<GPUTrace> CreateTrace(const std::string& category, | 97 scoped_refptr<GPUTrace> CreateTrace(const std::string& category, |
98 const std::string& name); | 98 const std::string& name); |
99 virtual scoped_refptr<Outputter> CreateOutputter(const std::string& name); | 99 virtual scoped_refptr<Outputter> CreateOutputter(const std::string& name); |
100 virtual scoped_refptr<CPUTime> CreateCPUTime(); | 100 virtual scoped_refptr<CPUTime> CreateCPUTime(); |
101 virtual GpuTracerType DetermineTracerType(); | 101 virtual GpuTracerType DetermineTracerType(); |
102 virtual void PostTask(); | 102 virtual void PostTask(); |
103 | 103 |
104 void Process(); | 104 void Process(); |
105 void ProcessTraces(); | 105 void ProcessTraces(); |
106 | 106 |
107 void CalculateTimerOffset(); | 107 void CalculateTimerOffset(); |
108 void IssueProcessTask(); | 108 void IssueProcessTask(); |
109 | 109 |
110 scoped_refptr<Outputter> outputter_; | 110 scoped_refptr<Outputter> outputter_; |
111 scoped_refptr<CPUTime> cpu_time_; | 111 scoped_refptr<CPUTime> cpu_time_; |
112 std::vector<TraceMarker> markers_[NUM_TRACER_SOURCES]; | 112 std::vector<TraceMarker> markers_[NUM_TRACER_SOURCES]; |
113 std::deque<scoped_refptr<GPUTrace> > traces_; | 113 std::deque<scoped_refptr<GPUTrace> > traces_; |
114 | 114 |
115 const unsigned char* gpu_trace_srv_category; | 115 const unsigned char* gpu_trace_srv_category; |
116 const unsigned char* gpu_trace_dev_category; | 116 const unsigned char* gpu_trace_dev_category; |
117 gles2::GLES2Decoder* decoder_; | 117 gles2::GLES2Decoder* decoder_; |
118 | 118 |
119 int64 timer_offset_; | 119 int64 timer_offset_; |
120 GpuTracerSource last_tracer_source_; | |
121 | 120 |
122 GpuTracerType tracer_type_; | 121 GpuTracerType tracer_type_; |
123 bool gpu_timing_synced_; | 122 bool gpu_timing_synced_; |
124 bool gpu_executing_; | 123 bool gpu_executing_; |
125 bool process_posted_; | 124 bool process_posted_; |
126 | 125 |
127 DISALLOW_COPY_AND_ASSIGN(GPUTracer); | 126 DISALLOW_COPY_AND_ASSIGN(GPUTracer); |
128 }; | 127 }; |
129 | 128 |
130 class Outputter : public base::RefCounted<Outputter> { | 129 class Outputter : public base::RefCounted<Outputter> { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 public: | 178 public: |
180 GPUTrace(scoped_refptr<Outputter> outputter, | 179 GPUTrace(scoped_refptr<Outputter> outputter, |
181 scoped_refptr<CPUTime> cpu_time, | 180 scoped_refptr<CPUTime> cpu_time, |
182 const std::string& category, | 181 const std::string& category, |
183 const std::string& name, | 182 const std::string& name, |
184 int64 offset, | 183 int64 offset, |
185 GpuTracerType tracer_type); | 184 GpuTracerType tracer_type); |
186 | 185 |
187 bool IsEnabled() { return tracer_type_ != kTracerTypeInvalid; } | 186 bool IsEnabled() { return tracer_type_ != kTracerTypeInvalid; } |
188 | 187 |
189 const std::string& category() { return category_; } | |
190 const std::string& name() { return name_; } | |
191 | |
192 void Start(bool trace_service); | 188 void Start(bool trace_service); |
193 void End(bool tracing_service); | 189 void End(bool tracing_service); |
194 bool IsAvailable(); | 190 bool IsAvailable(); |
195 void Process(); | 191 void Process(); |
196 | 192 |
197 private: | 193 private: |
198 ~GPUTrace(); | 194 ~GPUTrace(); |
199 | 195 |
200 void Output(); | 196 void Output(); |
201 | 197 |
(...skipping 12 matching lines...) Expand all Loading... |
214 | 210 |
215 GLuint queries_[2]; | 211 GLuint queries_[2]; |
216 | 212 |
217 DISALLOW_COPY_AND_ASSIGN(GPUTrace); | 213 DISALLOW_COPY_AND_ASSIGN(GPUTrace); |
218 }; | 214 }; |
219 | 215 |
220 } // namespace gles2 | 216 } // namespace gles2 |
221 } // namespace gpu | 217 } // namespace gpu |
222 | 218 |
223 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 219 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
OLD | NEW |