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

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

Issue 799753009: Added GPU Tracing for DoSwapBuffers() to track frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move synchronous trace modification to its own CL Created 5 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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 9735 matching lines...) Expand 10 before | Expand all | Expand 10 after
9746 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), 9746 "GLImpl", static_cast<int>(gfx::GetGLImplementation()),
9747 "width", (is_offscreen ? offscreen_size_.width() : 9747 "width", (is_offscreen ? offscreen_size_.width() :
9748 surface_->GetSize().width())); 9748 surface_->GetSize().width()));
9749 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", 9749 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers",
9750 "offscreen", is_offscreen, 9750 "offscreen", is_offscreen,
9751 "frame", this_frame_number); 9751 "frame", this_frame_number);
9752 { 9752 {
9753 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); 9753 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame");
9754 } 9754 }
9755 9755
9756 struct GPUSwapBufferTrace {
9757 public:
9758 GPUSwapBufferTrace(GPUTracer* gpu_tracer, int frame)
vmiura 2015/01/16 20:39:34 As discussed offline, maybe make this a generic Sc
David Yen 2015/01/16 21:34:19 Done.
9759 : gpu_tracer_(gpu_tracer) {
9760 gpu_tracer_->Begin("SwapBuffer", "DoSwapBuffers", kTraceSwapBuffer);
9761 }
9762
9763 ~GPUSwapBufferTrace() {
9764 gpu_tracer_->End(kTraceSwapBuffer);
9765 }
9766
9767 private:
9768 GPUTracer* gpu_tracer_;
9769 } swap_buffer_trace(gpu_tracer_.get(), this_frame_number);
9770
9756 bool is_tracing; 9771 bool is_tracing;
9757 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), 9772 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"),
9758 &is_tracing); 9773 &is_tracing);
9759 if (is_tracing) { 9774 if (is_tracing) {
9760 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); 9775 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId());
9761 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( 9776 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer(
9762 is_offscreen ? offscreen_size_ : surface_->GetSize()); 9777 is_offscreen ? offscreen_size_ : surface_->GetSize());
9763 } 9778 }
9764 9779
9765 // If offscreen then don't actually SwapBuffers to the display. Just copy 9780 // If offscreen then don't actually SwapBuffers to the display. Just copy
(...skipping 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after
11640 } 11655 }
11641 } 11656 }
11642 11657
11643 // Include the auto-generated part of this file. We split this because it means 11658 // Include the auto-generated part of this file. We split this because it means
11644 // we can easily edit the non-auto generated parts right here in this file 11659 // we can easily edit the non-auto generated parts right here in this file
11645 // instead of having to edit some template or the code generator. 11660 // instead of having to edit some template or the code generator.
11646 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 11661 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
11647 11662
11648 } // namespace gles2 11663 } // namespace gles2
11649 } // namespace gpu 11664 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gpu_tracer.h » ('j') | gpu/command_buffer/service/gpu_tracer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698