1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

Ladybird+LibWebView: Add -P/--enable-callgrind-profiling option

This adds a -P option to run Ladybird under callgrind. It starts with
instrumentation disabled. To start capturing a profile (once Ladybird
has launched) run `callgrind_control -i on` and to stop it again run
`callgrind_control -i off`.

P.s. This is pretty much stolen from Andreas (and is based on the patch
everyone [that wants a profile] have been manually applying).
This commit is contained in:
MacDue 2023-04-15 01:04:28 +01:00 committed by Andreas Kling
parent 5db1eb9961
commit 0329ddf46a
12 changed files with 52 additions and 26 deletions

View file

@ -27,9 +27,11 @@
extern DeprecatedString s_serenity_resource_root;
extern Browser::Settings* s_settings;
BrowserWindow::BrowserWindow(Browser::CookieJar& cookie_jar, StringView webdriver_content_ipc_path)
BrowserWindow::BrowserWindow(Browser::CookieJar& cookie_jar, StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling)
: m_cookie_jar(cookie_jar)
, m_webdriver_content_ipc_path(webdriver_content_ipc_path)
, m_enable_callgrind_profiling(enable_callgrind_profiling)
{
m_tabs_container = new QTabWidget(this);
m_tabs_container->installEventFilter(this);
@ -348,7 +350,7 @@ void BrowserWindow::debug_request(DeprecatedString const& request, DeprecatedStr
Tab& BrowserWindow::new_tab(QString const& url, Web::HTML::ActivateTab activate_tab)
{
auto tab = make<Tab>(this, m_webdriver_content_ipc_path);
auto tab = make<Tab>(this, m_webdriver_content_ipc_path, m_enable_callgrind_profiling);
auto tab_ptr = tab.ptr();
m_tabs.append(std::move(tab));