Commit eba91421 authored by Etienne Bergeron's avatar Etienne Bergeron Committed by Commit Bot

Activate GPU main thread stack sampling through slow-reports

This CL is adding the support for the stack sampling profiler to the GPU
main thread. The |tracing_sampler_profiler| is an adaptor that forward
stack sample as trace events. These events are collected by slow-reports.

This code is only running when the trace category "cpu_sampler" is
activated and should not affect performance otherwise.

R=piman@chromium.org, ssid@chromium.org

Bug: 888580
Change-Id: Ie703d965c1d158581da6fac1ac0f6ea2157ed6f1
Reviewed-on: https://chromium-review.googlesource.com/1249534Reviewed-by: default avatarSiddhartha S <ssid@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594872}
parent 5865a897
......@@ -20,6 +20,7 @@
#include "base/timer/hi_res_timer_manager.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "components/tracing/common/tracing_sampler_profiler.h"
#include "components/viz/service/main/viz_main_impl.h"
#include "content/common/content_constants_internal.h"
#include "content/common/content_switches_internal.h"
......@@ -336,6 +337,12 @@ int GpuMain(const MainFunctionParams& parameters) {
gpu_process.set_main_thread(child_thread);
// Setup tracing sampler profiler as early as possible.
auto tracing_sampler_profiler =
std::make_unique<tracing::TracingSamplerProfiler>(
base::PlatformThread::CurrentId());
tracing_sampler_profiler->OnMessageLoopStarted();
#if defined(OS_ANDROID)
base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment