New issue
Advanced search Search tips

Issue 890456 link

Starred by 2 users

Issue metadata

Status: Unconfirmed
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Headless Chromium does not support CPU profiling

Reported by br...@amazon.com, Sep 28

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/69.0.3497.81 Chrome/69.0.3497.81 Safari/537.36

Steps to reproduce the problem:
1. Build headless chromium with these args.gn:
is_debug = false
enable_profiling = true
enable_callgrind = true

2. Start it like so:
./out/Default/headless_shell --no-sandbox --enable-profiling --profiling-at-start --profiling-flush --remote-debugging-port=9222 https://youtube.com

3. Observe no chrome-profile-{process type}-{process ID} files are generated.

What is the expected behavior?
chrome-profile-{process type}-{process ID} files get generated containing CPU profiling data.

What went wrong?
chrome-profile-{process type}-{process ID} files are not generated.

From a cursory look at the code, it appears that the profiler only gets started in the Chrome layer, which would explain why it doesn't work in headless.  For example, this flag check: https://cs.chromium.org/chromium/src/chrome/common/profiling.cc?l=112&rcl=948e60271bbd01695e317c0d2bb8be041e2e73db , which looks to be called from chrome_main_delegate.cc

Did this work before? No 

Does this work in other browsers? N/A

Chrome version:   Channel: n/a
OS Version: 
Flash Version: 

Is it possible to factor CPU profiling out of the Chrome layer to make CPU profiling Headless Chromium possible?
 
Labels: Needs-Triage-M69
Components: Internals>Headless
Labels: Triaged-ET TE-NeedsTriageHelp Proj-Headless
The issue seems to be out of TE-scope as it is related to proj-headless. Hence, adding label TE-NeedsTriageHelp for further investigation from dev team.

Thanks...!!
Project Member

Comment 4 by bugdroid1@chromium.org, Nov 7

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/96b0777d0578696cf83f85b03707beea4edd7276

commit 96b0777d0578696cf83f85b03707beea4edd7276
Author: Bryce Thomas <bryct@amazon.com>
Date: Wed Nov 07 03:04:15 2018

Add support for CPU profiling in headless_shell.

This CL factors CPU profiling code out of chrome/ and into content/ to support
CPU profiling Headless Chromium.  headless_content_main_delegate.cc has been
modified to honor CPU profiling flags à la chrome_main_delegate.cc.

Bug: 890456
Change-Id: I76842c5936de82d6bd42354c461aff9e0d273248
Reviewed-on: https://chromium-review.googlesource.com/c/1312157
Commit-Queue: Bryce Thomas <bryct@amazon.com>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605942}
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/base/base_switches.cc
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/base/base_switches.h
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/chrome/app/chrome_main_delegate.cc
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/chrome/browser/chrome_content_browser_client.cc
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/chrome/browser/ui/browser.cc
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/chrome/browser/ui/browser_command_controller.cc
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/chrome/browser/ui/toolbar/app_menu_model.cc
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/chrome/common/BUILD.gn
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/chrome/common/chrome_switches.cc
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/chrome/common/chrome_switches.h
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/content/browser/gpu/gpu_process_host.cc
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/content/browser/renderer_host/render_process_host_impl.cc
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/content/public/common/BUILD.gn
[rename] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/content/public/common/profiling.cc
[rename] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/content/public/common/profiling.h
[modify] https://crrev.com/96b0777d0578696cf83f85b03707beea4edd7276/headless/lib/headless_content_main_delegate.cc

Sign in to add a comment