| 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 <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 17 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 17 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 18 #include "gpu/command_buffer/service/gpu_timing.h" | |
| 19 #include "gpu/gpu_export.h" | 18 #include "gpu/gpu_export.h" |
| 20 | 19 |
| 21 namespace gpu { | 20 namespace gpu { |
| 21 class GPUTiming; |
| 22 class GPUTimingClient; |
| 23 class GPUTimer; |
| 24 } |
| 25 |
| 26 namespace gpu { |
| 22 namespace gles2 { | 27 namespace gles2 { |
| 23 | 28 |
| 24 class Outputter; | 29 class Outputter; |
| 25 class GPUTrace; | 30 class GPUTrace; |
| 26 | 31 |
| 27 // Id used to keep trace namespaces separate | 32 // Id used to keep trace namespaces separate |
| 28 enum GpuTracerSource { | 33 enum GpuTracerSource { |
| 29 kTraceGroupInvalid = -1, | 34 kTraceGroupInvalid = -1, |
| 30 | 35 |
| 31 kTraceGroupMarker = 0, | 36 kTraceGroupMarker = 0, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 protected: | 80 protected: |
| 76 // Trace Processing. | 81 // Trace Processing. |
| 77 virtual scoped_refptr<Outputter> CreateOutputter(const std::string& name); | 82 virtual scoped_refptr<Outputter> CreateOutputter(const std::string& name); |
| 78 virtual void PostTask(); | 83 virtual void PostTask(); |
| 79 | 84 |
| 80 void Process(); | 85 void Process(); |
| 81 void ProcessTraces(); | 86 void ProcessTraces(); |
| 82 | 87 |
| 83 void IssueProcessTask(); | 88 void IssueProcessTask(); |
| 84 | 89 |
| 90 scoped_refptr<GPUTimingClient> gpu_timing_client_; |
| 85 scoped_refptr<Outputter> outputter_; | 91 scoped_refptr<Outputter> outputter_; |
| 86 std::vector<TraceMarker> markers_[NUM_TRACER_SOURCES]; | 92 std::vector<TraceMarker> markers_[NUM_TRACER_SOURCES]; |
| 87 std::deque<scoped_refptr<GPUTrace> > traces_; | 93 std::deque<scoped_refptr<GPUTrace> > traces_; |
| 88 | 94 |
| 89 const unsigned char* gpu_trace_srv_category; | 95 const unsigned char* gpu_trace_srv_category; |
| 90 const unsigned char* gpu_trace_dev_category; | 96 const unsigned char* gpu_trace_dev_category; |
| 91 gles2::GLES2Decoder* decoder_; | 97 gles2::GLES2Decoder* decoder_; |
| 92 gpu::GPUTiming gpu_timing_; | |
| 93 | 98 |
| 94 bool gpu_executing_; | 99 bool gpu_executing_; |
| 95 bool process_posted_; | 100 bool process_posted_; |
| 96 | 101 |
| 97 private: | 102 private: |
| 98 DISALLOW_COPY_AND_ASSIGN(GPUTracer); | 103 DISALLOW_COPY_AND_ASSIGN(GPUTracer); |
| 99 }; | 104 }; |
| 100 | 105 |
| 101 class Outputter : public base::RefCounted<Outputter> { | 106 class Outputter : public base::RefCounted<Outputter> { |
| 102 public: | 107 public: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 uint64 local_trace_id_; | 144 uint64 local_trace_id_; |
| 140 | 145 |
| 141 private: | 146 private: |
| 142 DISALLOW_COPY_AND_ASSIGN(TraceOutputter); | 147 DISALLOW_COPY_AND_ASSIGN(TraceOutputter); |
| 143 }; | 148 }; |
| 144 | 149 |
| 145 class GPU_EXPORT GPUTrace | 150 class GPU_EXPORT GPUTrace |
| 146 : public base::RefCounted<GPUTrace> { | 151 : public base::RefCounted<GPUTrace> { |
| 147 public: | 152 public: |
| 148 GPUTrace(scoped_refptr<Outputter> outputter, | 153 GPUTrace(scoped_refptr<Outputter> outputter, |
| 149 gpu::GPUTiming* gpu_timing, | 154 GPUTimingClient* gpu_timing_client, |
| 150 const std::string& category, | 155 const std::string& category, |
| 151 const std::string& name, | 156 const std::string& name, |
| 152 const bool enabled); | 157 const bool enabled); |
| 153 | 158 |
| 154 void Start(bool trace_service); | 159 void Start(bool trace_service); |
| 155 void End(bool tracing_service); | 160 void End(bool tracing_service); |
| 156 bool IsAvailable(); | 161 bool IsAvailable(); |
| 157 bool IsEnabled() { return enabled_; } | 162 bool IsEnabled() { return enabled_; } |
| 158 void Process(); | 163 void Process(); |
| 159 | 164 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 187 | 192 |
| 188 private: | 193 private: |
| 189 GPUTracer* gpu_tracer_; | 194 GPUTracer* gpu_tracer_; |
| 190 GpuTracerSource source_; | 195 GpuTracerSource source_; |
| 191 }; | 196 }; |
| 192 | 197 |
| 193 } // namespace gles2 | 198 } // namespace gles2 |
| 194 } // namespace gpu | 199 } // namespace gpu |
| 195 | 200 |
| 196 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 201 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
| OLD | NEW |