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

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

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 12 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 #include "gpu/command_buffer/service/gpu_tracer.h" 5 #include "gpu/command_buffer/service/gpu_tracer.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include <deque> 10 #include <deque>
8 11
9 #include "base/bind.h" 12 #include "base/bind.h"
10 #include "base/location.h" 13 #include "base/location.h"
11 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
12 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
14 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
15 #include "base/time/time.h" 18 #include "base/time/time.h"
16 #include "base/trace_event/trace_event.h" 19 #include "base/trace_event/trace_event.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 : named_thread_(name.c_str()) { 57 : named_thread_(name.c_str()) {
55 named_thread_.Start(); 58 named_thread_.Start();
56 named_thread_.Stop(); 59 named_thread_.Stop();
57 } 60 }
58 61
59 TraceOutputter::~TraceOutputter() { g_outputter_thread = NULL; } 62 TraceOutputter::~TraceOutputter() { g_outputter_thread = NULL; }
60 63
61 void TraceOutputter::TraceDevice(GpuTracerSource source, 64 void TraceOutputter::TraceDevice(GpuTracerSource source,
62 const std::string& category, 65 const std::string& category,
63 const std::string& name, 66 const std::string& name,
64 int64 start_time, 67 int64_t start_time,
65 int64 end_time) { 68 int64_t end_time) {
66 DCHECK(source >= 0 && source < NUM_TRACER_SOURCES); 69 DCHECK(source >= 0 && source < NUM_TRACER_SOURCES);
67 TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP2( 70 TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP2(
68 TRACE_DISABLED_BY_DEFAULT("gpu.device"), 71 TRACE_DISABLED_BY_DEFAULT("gpu.device"),
69 name.c_str(), 72 name.c_str(),
70 local_trace_device_id_, 73 local_trace_device_id_,
71 named_thread_.GetThreadId(), 74 named_thread_.GetThreadId(),
72 start_time, 75 start_time,
73 "gl_category", 76 "gl_category",
74 category.c_str(), 77 category.c_str(),
75 "channel", 78 "channel",
(...skipping 26 matching lines...) Expand all
102 105
103 trace_service_id_stack_[source].push(local_trace_service_id_); 106 trace_service_id_stack_[source].push(local_trace_service_id_);
104 ++local_trace_service_id_; 107 ++local_trace_service_id_;
105 } 108 }
106 109
107 void TraceOutputter::TraceServiceEnd(GpuTracerSource source, 110 void TraceOutputter::TraceServiceEnd(GpuTracerSource source,
108 const std::string& category, 111 const std::string& category,
109 const std::string& name) { 112 const std::string& name) {
110 DCHECK(source >= 0 && source < NUM_TRACER_SOURCES); 113 DCHECK(source >= 0 && source < NUM_TRACER_SOURCES);
111 DCHECK(!trace_service_id_stack_[source].empty()); 114 DCHECK(!trace_service_id_stack_[source].empty());
112 const uint64 local_trace_id = trace_service_id_stack_[source].top(); 115 const uint64_t local_trace_id = trace_service_id_stack_[source].top();
113 trace_service_id_stack_[source].pop(); 116 trace_service_id_stack_[source].pop();
114 117
115 TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TTS2( 118 TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TTS2(
116 TRACE_DISABLED_BY_DEFAULT("gpu.service"), 119 TRACE_DISABLED_BY_DEFAULT("gpu.service"),
117 name.c_str(), local_trace_id, 120 name.c_str(), local_trace_id,
118 "gl_category", category.c_str(), 121 "gl_category", category.c_str(),
119 "channel", kGpuTraceSourceNames[source]); 122 "channel", kGpuTraceSourceNames[source]);
120 } 123 }
121 124
122 GPUTrace::GPUTrace(scoped_refptr<Outputter> outputter, 125 GPUTrace::GPUTrace(scoped_refptr<Outputter> outputter,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 167 }
165 168
166 bool GPUTrace::IsAvailable() { 169 bool GPUTrace::IsAvailable() {
167 return !gpu_timer_.get() || gpu_timer_->IsAvailable(); 170 return !gpu_timer_.get() || gpu_timer_->IsAvailable();
168 } 171 }
169 172
170 void GPUTrace::Process() { 173 void GPUTrace::Process() {
171 if (gpu_timer_.get() && device_enabled_) { 174 if (gpu_timer_.get() && device_enabled_) {
172 DCHECK(IsAvailable()); 175 DCHECK(IsAvailable());
173 176
174 int64 start = 0; 177 int64_t start = 0;
175 int64 end = 0; 178 int64_t end = 0;
176 gpu_timer_->GetStartEndTimestamps(&start, &end); 179 gpu_timer_->GetStartEndTimestamps(&start, &end);
177 outputter_->TraceDevice(source_, category_, name_, start, end); 180 outputter_->TraceDevice(source_, category_, name_, start, end);
178 } 181 }
179 } 182 }
180 183
181 GPUTracer::GPUTracer(gles2::GLES2Decoder* decoder) 184 GPUTracer::GPUTracer(gles2::GLES2Decoder* decoder)
182 : gpu_trace_srv_category(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( 185 : gpu_trace_srv_category(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
183 TRACE_DISABLED_BY_DEFAULT("gpu.service"))), 186 TRACE_DISABLED_BY_DEFAULT("gpu.service"))),
184 gpu_trace_dev_category(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( 187 gpu_trace_dev_category(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
185 TRACE_DISABLED_BY_DEFAULT("gpu.device"))), 188 TRACE_DISABLED_BY_DEFAULT("gpu.device"))),
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 return markers_[source].back().name_; 372 return markers_[source].back().name_;
370 } 373 }
371 return base::EmptyString(); 374 return base::EmptyString();
372 } 375 }
373 376
374 scoped_refptr<Outputter> GPUTracer::CreateOutputter(const std::string& name) { 377 scoped_refptr<Outputter> GPUTracer::CreateOutputter(const std::string& name) {
375 return TraceOutputter::Create(name); 378 return TraceOutputter::Create(name);
376 } 379 }
377 380
378 bool GPUTracer::CheckDisjointStatus() { 381 bool GPUTracer::CheckDisjointStatus() {
379 const int64 current_time = gpu_timing_client_->GetCurrentCPUTime(); 382 const int64_t current_time = gpu_timing_client_->GetCurrentCPUTime();
380 if (*gpu_trace_dev_category == 0) 383 if (*gpu_trace_dev_category == 0)
381 return false; 384 return false;
382 385
383 bool status = gpu_timing_client_->CheckAndResetTimerErrors(); 386 bool status = gpu_timing_client_->CheckAndResetTimerErrors();
384 if (status && began_device_traces_) { 387 if (status && began_device_traces_) {
385 // Log disjoint event if we have active traces. 388 // Log disjoint event if we have active traces.
386 const std::string unique_disjoint_name = 389 const std::string unique_disjoint_name =
387 base::StringPrintf("DisjointEvent-%p", this); 390 base::StringPrintf("DisjointEvent-%p", this);
388 outputter_->TraceDevice(kTraceDisjoint, 391 outputter_->TraceDevice(kTraceDisjoint,
389 "DisjointEvent", 392 "DisjointEvent",
(...skipping 17 matching lines...) Expand all
407 } 410 }
408 411
409 while (!finished_traces_.empty()) { 412 while (!finished_traces_.empty()) {
410 finished_traces_.front()->Destroy(have_context); 413 finished_traces_.front()->Destroy(have_context);
411 finished_traces_.pop_front(); 414 finished_traces_.pop_front();
412 } 415 }
413 } 416 }
414 417
415 } // namespace gles2 418 } // namespace gles2
416 } // namespace gpu 419 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_tracer.h ('k') | gpu/command_buffer/service/gpu_tracer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698