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

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: Fixed another GPU_EXPORT issue. 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/gpu_tracer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "gpu/gpu_export.h"
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,
47 int64 end_time) = 0;
48
49 protected:
50 virtual ~Outputter() {}
51 friend class base::RefCounted<Outputter>;
52 };
53
54 class TraceOutputter : public Outputter {
55 public:
56 static scoped_refptr<TraceOutputter> Create(const std::string& name);
57 virtual void Trace(const std::string& name,
58 int64 start_time,
59 int64 end_time) OVERRIDE;
60
61 protected:
62 friend class base::RefCounted<Outputter>;
63 explicit TraceOutputter(const std::string& name);
64 virtual ~TraceOutputter();
65
66 base::Thread named_thread_;
67 uint64 local_trace_id_;
68
69 DISALLOW_COPY_AND_ASSIGN(TraceOutputter);
70 };
71
72 class GPU_EXPORT Trace : public base::RefCounted<Trace> {
73 public:
74 explicit Trace(const std::string& name) : name_(name) {}
75
76 virtual void Start() = 0;
77 virtual void End() = 0;
78
79 // True if the the results of this query are available.
80 virtual bool IsAvailable() = 0;
81
82 virtual bool IsProcessable();
83 virtual void Process() = 0;
84
85 virtual const std::string& name();
86
87 protected:
88 virtual ~Trace() {}
89
90 private:
91 friend class base::RefCounted<Trace>;
92
93 std::string name_;
94
95 DISALLOW_COPY_AND_ASSIGN(Trace);
96 };
97
98 class GPU_EXPORT GLARBTimerTrace : public Trace {
99 public:
100 GLARBTimerTrace(scoped_refptr<Outputter> outputter,
101 const std::string& name,
102 int64 offset);
103
104 // Implementation of Tracer
105 virtual void Start() OVERRIDE;
106 virtual void End() OVERRIDE;
107 virtual bool IsAvailable() OVERRIDE;
108 virtual void Process() OVERRIDE;
109
110 private:
111 virtual ~GLARBTimerTrace();
112
113 void Output();
114
115 scoped_refptr<Outputter> outputter_;
116
117 int64 offset_;
118 int64 start_time_;
119 int64 end_time_;
120 bool end_requested_;
121
122 GLuint queries_[2];
123
124 DISALLOW_COPY_AND_ASSIGN(GLARBTimerTrace);
125 };
126
39 } // namespace gles2 127 } // namespace gles2
40 } // namespace gpu 128 } // namespace gpu
41 129
42 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ 130 #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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698