Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: gpu/command_buffer/service/gpu_tracer.h

Issue 122723002: Fixed not-unique event 'id' in TRACE_EVENT from GLARBTimerTrace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix new line at eof. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread.h"
15
16 #include "ui/gl/gl_bindings.h"
13 17
14 namespace gpu { 18 namespace gpu {
15 namespace gles2 { 19 namespace gles2 {
16 20
17 // Traces GPU Commands. 21 // Traces GPU Commands.
18 class GPUTracer { 22 class GPUTracer {
19 public: 23 public:
20 static scoped_ptr<GPUTracer> Create(); 24 static scoped_ptr<GPUTracer> Create();
21 25
22 GPUTracer() {} 26 GPUTracer() {}
23 virtual ~GPUTracer() {} 27 virtual ~GPUTracer() {}
24 28
25 // Begin a trace. 29 // Begin a trace.
26 virtual bool Begin(const std::string& name) = 0; 30 virtual bool Begin(const std::string& name) = 0;
27 31
28 // End the last started trace. 32 // End the last started trace.
29 virtual bool End() = 0; 33 virtual bool End() = 0;
30 34
31 // Retrieve the name of the current open trace. 35 // Retrieve the name of the current open trace.
32 // Returns empty string if no current open trace. 36 // Returns empty string if no current open trace.
33 virtual const std::string& CurrentName() const = 0; 37 virtual const std::string& CurrentName() const = 0;
34 38
35 private: 39 private:
36 DISALLOW_COPY_AND_ASSIGN(GPUTracer); 40 DISALLOW_COPY_AND_ASSIGN(GPUTracer);
37 }; 41 };
38 42
43 class Outputter : public base::RefCounted<Outputter> {
44 public:
45 virtual void Trace(const std::string& name,
46 int64 start_time, int64 end_time) = 0;
47
48 protected:
49 virtual ~Outputter() {}
50 friend class base::RefCounted<Outputter>;
51 };
52
53 class TraceOutputter
54 : public Outputter, private base::Thread {
piman 2014/01/07 22:47:49 Instead of private inheritance, can you make a bas
vmiura 2014/01/07 23:26:47 Done.
55 public:
56 static scoped_refptr<TraceOutputter> Create(const std::string& name);
57 virtual void Trace(const std::string& name, int64 start_time,
58 int64 end_time) OVERRIDE;
59
60 protected:
61 friend class base::RefCounted<Outputter>;
62 explicit TraceOutputter(const std::string& name);
63 virtual ~TraceOutputter();
64
65 uint64 local_trace_id_;
66
67 DISALLOW_COPY_AND_ASSIGN(TraceOutputter);
68 };
69
70 class Trace : public base::RefCounted<Trace> {
71 public:
72 explicit Trace(const std::string& name) : name_(name) {}
73
74 virtual void Start() = 0;
75 virtual void End() = 0;
76
77 // True if the the results of this query are available.
78 virtual bool IsAvailable() = 0;
79
80 virtual bool IsProcessable();
81 virtual void Process() = 0;
82
83 virtual const std::string& name();
84
85 protected:
86 virtual ~Trace() {}
87
88 private:
89 friend class base::RefCounted<Trace>;
90
91 std::string name_;
92
93 DISALLOW_COPY_AND_ASSIGN(Trace);
94 };
95
96 class GLARBTimerTrace : public Trace {
97 public:
98 GLARBTimerTrace(scoped_refptr<Outputter> outputter,
99 const std::string& name,
100 int64 offset);
101
102 // Implementation of Tracer
103 virtual void Start() OVERRIDE;
104 virtual void End() OVERRIDE;
105 virtual bool IsAvailable() OVERRIDE;
106 virtual void Process() OVERRIDE;
107
108 private:
109 virtual ~GLARBTimerTrace();
110
111 void Output();
112
113 scoped_refptr<Outputter> outputter_;
114
115 int64 offset_;
116 int64 start_time_;
117 int64 end_time_;
118 bool end_requested_;
119
120 GLuint queries_[2];
121
122 DISALLOW_COPY_AND_ASSIGN(GLARBTimerTrace);
123 };
124
39 } // namespace gles2 125 } // namespace gles2
40 } // namespace gpu 126 } // namespace gpu
41 127
42 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ 128 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gpu_tracer.cc » ('j') | gpu/command_buffer/service/gpu_tracer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698