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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 bool Begin(const std::string& category, const std::string& name, | 66 bool Begin(const std::string& category, const std::string& name, |
67 GpuTracerSource source); | 67 GpuTracerSource source); |
68 | 68 |
69 // End the last started trace marker. | 69 // End the last started trace marker. |
70 bool End(GpuTracerSource source); | 70 bool End(GpuTracerSource source); |
71 | 71 |
72 bool IsTracing(); | 72 bool IsTracing(); |
73 | 73 |
74 // Retrieve the name of the current open trace. | 74 // Retrieve the name of the current open trace. |
75 // Returns empty string if no current open trace. | 75 // Returns empty string if no current open trace. |
76 const std::string& CurrentCategory() const; | 76 const std::string& CurrentCategory(GpuTracerSource source) const; |
77 const std::string& CurrentName() const; | 77 const std::string& CurrentName(GpuTracerSource source) const; |
78 | 78 |
79 private: | 79 private: |
80 // Trace Processing. | 80 // Trace Processing. |
81 scoped_refptr<GPUTrace> CreateTrace(const std::string& category, | 81 scoped_refptr<GPUTrace> CreateTrace(const std::string& category, |
82 const std::string& name); | 82 const std::string& name); |
83 void Process(); | 83 void Process(); |
84 void ProcessTraces(); | 84 void ProcessTraces(); |
85 | 85 |
86 void CalculateTimerOffset(); | 86 void CalculateTimerOffset(); |
87 void IssueProcessTask(); | 87 void IssueProcessTask(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 : public base::RefCounted<GPUTrace> { | 140 : public base::RefCounted<GPUTrace> { |
141 public: | 141 public: |
142 GPUTrace(scoped_refptr<Outputter> outputter, | 142 GPUTrace(scoped_refptr<Outputter> outputter, |
143 const std::string& category, | 143 const std::string& category, |
144 const std::string& name, | 144 const std::string& name, |
145 int64 offset, | 145 int64 offset, |
146 GpuTracerType tracer_type); | 146 GpuTracerType tracer_type); |
147 | 147 |
148 bool IsEnabled() { return tracer_type_ != kTracerTypeInvalid; } | 148 bool IsEnabled() { return tracer_type_ != kTracerTypeInvalid; } |
149 | 149 |
150 const std::string& category() { return category_; } | |
151 const std::string& name() { return name_; } | |
152 | |
153 void Start(bool trace_service); | 150 void Start(bool trace_service); |
154 void End(bool tracing_service); | 151 void End(bool trace_service); |
155 bool IsAvailable(); | 152 bool IsAvailable(); |
156 void Process(); | 153 void Process(); |
157 | 154 |
158 private: | 155 private: |
159 ~GPUTrace(); | 156 ~GPUTrace(); |
160 | 157 |
161 void Output(); | 158 void Output(); |
162 | 159 |
163 friend class base::RefCounted<GPUTrace>; | 160 friend class base::RefCounted<GPUTrace>; |
164 | 161 |
165 std::string category_; | 162 std::string category_; |
166 std::string name_; | 163 std::string name_; |
167 scoped_refptr<Outputter> outputter_; | 164 scoped_refptr<Outputter> outputter_; |
168 | 165 |
169 int64 offset_; | 166 int64 offset_; |
170 int64 start_time_; | 167 int64 start_time_; |
171 int64 end_time_; | 168 int64 end_time_; |
172 GpuTracerType tracer_type_; | 169 GpuTracerType tracer_type_; |
173 bool end_requested_; | 170 bool end_requested_; |
174 | 171 |
175 GLuint queries_[2]; | 172 GLuint queries_[2]; |
176 | 173 |
177 DISALLOW_COPY_AND_ASSIGN(GPUTrace); | 174 DISALLOW_COPY_AND_ASSIGN(GPUTrace); |
178 }; | 175 }; |
179 | 176 |
180 } // namespace gles2 | 177 } // namespace gles2 |
181 } // namespace gpu | 178 } // namespace gpu |
182 | 179 |
183 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 180 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
OLD | NEW |