1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 11:55:07 +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

@ -67,11 +67,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
StringView raw_url;
StringView webdriver_content_ipc_path;
bool enable_callgrind_profiling = false;
Core::ArgsParser args_parser;
args_parser.set_general_help("The Ladybird web browser :^)");
args_parser.add_positional_argument(raw_url, "URL to open", "url", Core::ArgsParser::Required::No);
args_parser.add_option(webdriver_content_ipc_path, "Path to WebDriver IPC for WebContent", "webdriver-content-path", 0, "path");
args_parser.add_option(enable_callgrind_profiling, "Enable Callgrind profiling", "enable-callgrind-profiling", 'P');
args_parser.parse(arguments);
auto get_formatted_url = [&](StringView const& raw_url) -> ErrorOr<URL> {
@ -90,7 +92,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto cookie_jar = TRY(Browser::CookieJar::create(*database));
s_settings = adopt_own_if_nonnull(new Browser::Settings());
BrowserWindow window(cookie_jar, webdriver_content_ipc_path);
BrowserWindow window(cookie_jar, webdriver_content_ipc_path, enable_callgrind_profiling ? WebView::EnableCallgrindProfiling::Yes : WebView::EnableCallgrindProfiling::No);
window.setWindowTitle("Ladybird");
window.resize(800, 600);
window.show();