1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 09:24:57 +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

@ -55,7 +55,7 @@
#include <QTimer>
#include <QToolTip>
WebContentView::WebContentView(StringView webdriver_content_ipc_path)
WebContentView::WebContentView(StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling)
: m_webdriver_content_ipc_path(webdriver_content_ipc_path)
{
setMouseTracking(true);
@ -76,7 +76,7 @@ WebContentView::WebContentView(StringView webdriver_content_ipc_path)
update_viewport_rect();
});
create_client();
create_client(enable_callgrind_profiling);
}
WebContentView::~WebContentView()
@ -599,12 +599,12 @@ void WebContentView::update_palette()
client().async_update_system_theme(make_system_theme_from_qt_palette(*this));
}
void WebContentView::create_client()
void WebContentView::create_client(WebView::EnableCallgrindProfiling enable_callgrind_profiling)
{
m_client_state = {};
auto candidate_web_content_paths = get_paths_for_helper_process("WebContent"sv).release_value_but_fixme_should_propagate_errors();
auto new_client = launch_web_content_process(candidate_web_content_paths).release_value_but_fixme_should_propagate_errors();
auto new_client = launch_web_content_process(candidate_web_content_paths, enable_callgrind_profiling).release_value_but_fixme_should_propagate_errors();
m_web_content_notifier.setSocket(new_client->socket().fd().value());
m_web_content_notifier.setEnabled(true);