Commit 9349ee1a authored by Etienne Bergeron's avatar Etienne Bergeron Committed by Commit Bot

Add samping profiler to GPU compositor thread

This CL is adding a sampling profiler track for the compositor
thread to slow-reports.

The TracingSamplerProfiler is responsible to take CPU sampling
profiler and put them into tracing iff slow-reports is activated.
The class destructor is responsible to stop CPU sampling if
needed. The sampling profiler will be working for the whole
tracing session.

The TracingSamplerProfiler is able to manage turning on and off
tracing at any point in time.

For users not part of the control population, this should not
affect the performance at all.

Bug: 1064662
Change-Id: I658e97fcc6585918b6762878ade3a1ddb31f3a69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2119220Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Reviewed-by: default avataroysteine <oysteine@chromium.org>
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753779}
parent 9d10064e
......@@ -33,6 +33,7 @@ source_set("main") {
"//services/metrics/public/cpp:metrics_cpp",
"//services/metrics/public/mojom",
"//services/service_manager/public/cpp",
"//services/tracing/public/cpp",
"//services/viz/privileged/mojom",
"//ui/gfx:memory_buffer",
"//ui/gl/init",
......
......@@ -16,6 +16,7 @@ include_rules = [
"+services/metrics/public",
"+services/network/public/mojom",
"+services/service_manager/public/cpp",
"+services/tracing/public/cpp",
"+services/viz/privileged/mojom",
]
......
......@@ -27,6 +27,7 @@
#include "gpu/ipc/command_buffer_task_executor.h"
#include "gpu/ipc/scheduler_sequence.h"
#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
#include "services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.h"
#include "ui/gfx/switches.h"
#if BUILDFLAG(USE_VIZ_DEVTOOLS)
......@@ -74,6 +75,12 @@ std::unique_ptr<VizCompositorThreadType> CreateAndStartCompositorThread() {
#endif // !defined(OS_MACOSX)
CHECK(thread->StartWithOptions(thread_options));
// Setup tracing sampler profiler as early as possible.
thread->task_runner()->PostTask(
FROM_HERE,
base::BindOnce(&tracing::TracingSamplerProfiler::CreateOnChildThread));
return thread;
#endif // !defined(OS_ANDROID)
}
......
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