| 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 <deque> | 9 #include <deque> |
| 10 #include <stack> | 10 #include <stack> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Scheduled processing in decoder ends. | 65 // Scheduled processing in decoder ends. |
| 66 bool EndDecoding(); | 66 bool EndDecoding(); |
| 67 | 67 |
| 68 // Begin a trace marker. | 68 // Begin a trace marker. |
| 69 bool Begin(const std::string& category, const std::string& name, | 69 bool Begin(const std::string& category, const std::string& name, |
| 70 GpuTracerSource source); | 70 GpuTracerSource source); |
| 71 | 71 |
| 72 // End the last started trace marker. | 72 // End the last started trace marker. |
| 73 bool End(GpuTracerSource source); | 73 bool End(GpuTracerSource source); |
| 74 | 74 |
| 75 bool HasTracesToProcess(); |
| 76 void ProcessTraces(); |
| 77 |
| 75 virtual bool IsTracing(); | 78 virtual bool IsTracing(); |
| 76 | 79 |
| 77 // Retrieve the name of the current open trace. | 80 // Retrieve the name of the current open trace. |
| 78 // Returns empty string if no current open trace. | 81 // Returns empty string if no current open trace. |
| 79 const std::string& CurrentCategory(GpuTracerSource source) const; | 82 const std::string& CurrentCategory(GpuTracerSource source) const; |
| 80 const std::string& CurrentName(GpuTracerSource source) const; | 83 const std::string& CurrentName(GpuTracerSource source) const; |
| 81 | 84 |
| 82 protected: | 85 protected: |
| 83 // Trace Processing. | 86 // Trace Processing. |
| 84 virtual scoped_refptr<Outputter> CreateOutputter(const std::string& name); | 87 virtual scoped_refptr<Outputter> CreateOutputter(const std::string& name); |
| 85 virtual void PostTask(); | |
| 86 | 88 |
| 87 void Process(); | |
| 88 void ProcessTraces(); | |
| 89 bool CheckDisjointStatus(); | 89 bool CheckDisjointStatus(); |
| 90 void ClearOngoingTraces(bool have_context); | 90 void ClearOngoingTraces(bool have_context); |
| 91 | 91 |
| 92 void IssueProcessTask(); | |
| 93 | |
| 94 scoped_refptr<gfx::GPUTimingClient> gpu_timing_client_; | 92 scoped_refptr<gfx::GPUTimingClient> gpu_timing_client_; |
| 95 scoped_refptr<Outputter> outputter_; | 93 scoped_refptr<Outputter> outputter_; |
| 96 std::vector<TraceMarker> markers_[NUM_TRACER_SOURCES]; | 94 std::vector<TraceMarker> markers_[NUM_TRACER_SOURCES]; |
| 97 std::deque<scoped_refptr<GPUTrace> > finished_traces_; | 95 std::deque<scoped_refptr<GPUTrace> > finished_traces_; |
| 98 | 96 |
| 99 const unsigned char* gpu_trace_srv_category; | 97 const unsigned char* gpu_trace_srv_category; |
| 100 const unsigned char* gpu_trace_dev_category; | 98 const unsigned char* gpu_trace_dev_category; |
| 101 gles2::GLES2Decoder* decoder_; | 99 gles2::GLES2Decoder* decoder_; |
| 102 int64 disjoint_time_ = 0; | 100 int64 disjoint_time_ = 0; |
| 103 | 101 |
| 104 bool gpu_executing_ = false; | 102 bool gpu_executing_ = false; |
| 105 bool process_posted_ = false; | |
| 106 bool began_device_traces_ = false; | 103 bool began_device_traces_ = false; |
| 107 | 104 |
| 108 private: | 105 private: |
| 109 DISALLOW_COPY_AND_ASSIGN(GPUTracer); | 106 DISALLOW_COPY_AND_ASSIGN(GPUTracer); |
| 110 }; | 107 }; |
| 111 | 108 |
| 112 class Outputter : public base::RefCounted<Outputter> { | 109 class Outputter : public base::RefCounted<Outputter> { |
| 113 public: | 110 public: |
| 114 virtual void TraceDevice(GpuTracerSource source, | 111 virtual void TraceDevice(GpuTracerSource source, |
| 115 const std::string& category, | 112 const std::string& category, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 211 |
| 215 private: | 212 private: |
| 216 GPUTracer* gpu_tracer_; | 213 GPUTracer* gpu_tracer_; |
| 217 GpuTracerSource source_; | 214 GpuTracerSource source_; |
| 218 }; | 215 }; |
| 219 | 216 |
| 220 } // namespace gles2 | 217 } // namespace gles2 |
| 221 } // namespace gpu | 218 } // namespace gpu |
| 222 | 219 |
| 223 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 220 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
| OLD | NEW |