Index: gpu/command_buffer/service/gpu_tracer.h |
diff --git a/gpu/command_buffer/service/gpu_tracer.h b/gpu/command_buffer/service/gpu_tracer.h |
index 594a98ebcbdc3532bf2eae34206c9cc1546f005e..c8ac9d76b60339af790276713eef1bf56e03fe05 100644 |
--- a/gpu/command_buffer/service/gpu_tracer.h |
+++ b/gpu/command_buffer/service/gpu_tracer.h |
@@ -6,13 +6,16 @@ |
#ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
#define GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
+#include <deque> |
#include <string> |
+#include <vector> |
#include "base/basictypes.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
#include "base/threading/thread.h" |
#include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
+#include "gpu/command_buffer/service/gpu_timing.h" |
#include "gpu/gpu_export.h" |
#include "ui/gl/gl_bindings.h" |
@@ -33,28 +36,6 @@ enum GpuTracerSource { |
NUM_TRACER_SOURCES |
}; |
-enum GpuTracerType { |
- kTracerTypeInvalid = -1, |
- |
- kTracerTypeARBTimer, |
- kTracerTypeDisjointTimer |
-}; |
- |
-// Central accesser to CPU Time |
-class GPU_EXPORT CPUTime |
- : public base::RefCounted<CPUTime> { |
- public: |
- CPUTime(); |
- |
- virtual int64 GetCurrentTime(); |
- |
- protected: |
- virtual ~CPUTime(); |
- friend class base::RefCounted<CPUTime>; |
- |
- DISALLOW_COPY_AND_ASSIGN(CPUTime); |
-}; |
- |
// Marker structure for a Trace. |
struct TraceMarker { |
TraceMarker(const std::string& category, const std::string& name); |
@@ -94,35 +75,27 @@ class GPU_EXPORT GPUTracer |
protected: |
// Trace Processing. |
- scoped_refptr<GPUTrace> CreateTrace(const std::string& category, |
- const std::string& name); |
virtual scoped_refptr<Outputter> CreateOutputter(const std::string& name); |
- virtual scoped_refptr<CPUTime> CreateCPUTime(); |
- virtual GpuTracerType DetermineTracerType(); |
virtual void PostTask(); |
void Process(); |
void ProcessTraces(); |
- void CalculateTimerOffset(); |
void IssueProcessTask(); |
scoped_refptr<Outputter> outputter_; |
- scoped_refptr<CPUTime> cpu_time_; |
std::vector<TraceMarker> markers_[NUM_TRACER_SOURCES]; |
std::deque<scoped_refptr<GPUTrace> > traces_; |
const unsigned char* gpu_trace_srv_category; |
const unsigned char* gpu_trace_dev_category; |
gles2::GLES2Decoder* decoder_; |
+ gpu::GPUTiming gpu_timing_; |
- int64 timer_offset_; |
- |
- GpuTracerType tracer_type_; |
- bool gpu_timing_synced_; |
bool gpu_executing_; |
bool process_posted_; |
+ private: |
DISALLOW_COPY_AND_ASSIGN(GPUTracer); |
}; |
@@ -166,6 +139,7 @@ class TraceOutputter : public Outputter { |
base::Thread named_thread_; |
uint64 local_trace_id_; |
+ private: |
DISALLOW_COPY_AND_ASSIGN(TraceOutputter); |
}; |
@@ -173,17 +147,15 @@ class GPU_EXPORT GPUTrace |
: public base::RefCounted<GPUTrace> { |
public: |
GPUTrace(scoped_refptr<Outputter> outputter, |
- scoped_refptr<CPUTime> cpu_time, |
+ gpu::GPUTiming* gpu_timing, |
const std::string& category, |
const std::string& name, |
- int64 offset, |
- GpuTracerType tracer_type); |
- |
- bool IsEnabled() { return tracer_type_ != kTracerTypeInvalid; } |
+ const bool enabled); |
void Start(bool trace_service); |
void End(bool tracing_service); |
bool IsAvailable(); |
+ bool IsEnabled() { return enabled_; } |
void Process(); |
private: |
@@ -196,35 +168,27 @@ class GPU_EXPORT GPUTrace |
std::string category_; |
std::string name_; |
scoped_refptr<Outputter> outputter_; |
- scoped_refptr<CPUTime> cpu_time_; |
- |
- int64 offset_; |
- int64 start_time_; |
- int64 end_time_; |
- GpuTracerType tracer_type_; |
- bool end_requested_; |
- |
- GLuint queries_[2]; |
+ scoped_ptr<gpu::GPUTimer> gpu_timer_; |
+ const bool enabled_ = false; |
DISALLOW_COPY_AND_ASSIGN(GPUTrace); |
}; |
class ScopedGPUTrace { |
- public: |
- ScopedGPUTrace(GPUTracer* gpu_tracer, GpuTracerSource source, |
- const std::string& category, const std::string& name) |
- : gpu_tracer_(gpu_tracer), |
- source_(source) { |
- gpu_tracer_->Begin(category, name, source_); |
- } |
- |
- ~ScopedGPUTrace() { |
- gpu_tracer_->End(source_); |
- } |
- |
- private: |
- GPUTracer* gpu_tracer_; |
- GpuTracerSource source_; |
+ public: |
+ ScopedGPUTrace(GPUTracer* gpu_tracer, |
+ GpuTracerSource source, |
+ const std::string& category, |
+ const std::string& name) |
+ : gpu_tracer_(gpu_tracer), source_(source) { |
+ gpu_tracer_->Begin(category, name, source_); |
+ } |
+ |
+ ~ScopedGPUTrace() { gpu_tracer_->End(source_); } |
+ |
+ private: |
+ GPUTracer* gpu_tracer_; |
+ GpuTracerSource source_; |
}; |
} // namespace gles2 |