Chromium Code Reviews| 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 #include "gpu/command_buffer/service/gpu_tracer.h" | 5 #include "gpu/command_buffer/service/gpu_tracer.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 | 137 |
| 138 case kTracerTypeDisjointTimer: | 138 case kTracerTypeDisjointTimer: |
| 139 // For the disjoint timer, GPU idle time does not seem to increment the | 139 // For the disjoint timer, GPU idle time does not seem to increment the |
| 140 // internal counter. We must calculate the offset before any query. The | 140 // internal counter. We must calculate the offset before any query. The |
| 141 // good news is any device that supports disjoint timer will also support | 141 // good news is any device that supports disjoint timer will also support |
| 142 // glGetInteger64v, so we can query it directly unlike the ARBTimer case. | 142 // glGetInteger64v, so we can query it directly unlike the ARBTimer case. |
| 143 // The "offset_" variable will always be 0 during normal use cases, only | 143 // The "offset_" variable will always be 0 during normal use cases, only |
| 144 // under the unit tests will it be set to specific test values. | 144 // under the unit tests will it be set to specific test values. |
| 145 if (offset_ == 0) { | 145 if (offset_ == 0) { |
| 146 GLint64 gl_now = 0; | 146 GLint64 gl_now = 0; |
| 147 glGetInteger64v(GL_TIMESTAMP, &gl_now); | 147 glGetInteger64v(GL_TIMESTAMP, &gl_now); |
|
no sievers
2015/01/21 23:31:15
Am talking about this call site.
| |
| 148 offset_ = cpu_time_->GetCurrentTime() - | 148 offset_ = cpu_time_->GetCurrentTime() - |
| 149 gl_now / base::Time::kNanosecondsPerMicrosecond; | 149 gl_now / base::Time::kNanosecondsPerMicrosecond; |
| 150 } | 150 } |
| 151 // Intentionally fall through to kTracerTypeARBTimer case.xs | 151 // Intentionally fall through to kTracerTypeARBTimer case.xs |
| 152 case kTracerTypeARBTimer: | 152 case kTracerTypeARBTimer: |
| 153 // GL_TIMESTAMP and GL_TIMESTAMP_EXT both have the same value. | 153 // GL_TIMESTAMP and GL_TIMESTAMP_EXT both have the same value. |
| 154 glQueryCounter(queries_[0], GL_TIMESTAMP); | 154 glQueryCounter(queries_[0], GL_TIMESTAMP); |
| 155 break; | 155 break; |
| 156 } | 156 } |
| 157 } | 157 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 173 outputter_->TraceServiceEnd(category_, name_); | 173 outputter_->TraceServiceEnd(category_, name_); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 bool GPUTrace::IsAvailable() { | 177 bool GPUTrace::IsAvailable() { |
| 178 if (tracer_type_ != kTracerTypeInvalid) { | 178 if (tracer_type_ != kTracerTypeInvalid) { |
| 179 if (!end_requested_) | 179 if (!end_requested_) |
| 180 return false; | 180 return false; |
| 181 | 181 |
| 182 GLint done = 0; | 182 GLint done = 0; |
| 183 glGetQueryObjectiv(queries_[1], GL_QUERY_RESULT_AVAILABLE, &done); | 183 glGetQueryObjectivARB(queries_[1], GL_QUERY_RESULT_AVAILABLE, &done); |
|
no sievers
2015/01/21 23:24:45
So ignoring everything we do in other places (like
| |
| 184 return !!done; | 184 return !!done; |
| 185 } | 185 } |
| 186 | 186 |
| 187 return true; | 187 return true; |
| 188 } | 188 } |
| 189 | 189 |
| 190 void GPUTrace::Process() { | 190 void GPUTrace::Process() { |
| 191 if (tracer_type_ == kTracerTypeInvalid) | 191 if (tracer_type_ == kTracerTypeInvalid) |
| 192 return; | 192 return; |
| 193 | 193 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 481 void GPUTracer::IssueProcessTask() { | 481 void GPUTracer::IssueProcessTask() { |
| 482 if (traces_.empty() || process_posted_) | 482 if (traces_.empty() || process_posted_) |
| 483 return; | 483 return; |
| 484 | 484 |
| 485 process_posted_ = true; | 485 process_posted_ = true; |
| 486 PostTask(); | 486 PostTask(); |
| 487 } | 487 } |
| 488 | 488 |
| 489 } // namespace gles2 | 489 } // namespace gles2 |
| 490 } // namespace gpu | 490 } // namespace gpu |
| OLD | NEW |