diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-12 21:56:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-12 23:39:17 +0200 |
commit | f6ad7dfc0bdc2c7c05ec07c3d8c0df8e7f520020 (patch) | |
tree | 68d420b1b948b4be0cf027d15a9c81f92cc003fe | |
parent | 3f067f845796e592ffb5dff903034d79da900ec4 (diff) | |
download | serenity-f6ad7dfc0bdc2c7c05ec07c3d8c0df8e7f520020.zip |
LibWeb: Log classic script start, finish, and duration
When waiting for a page to load, it's nice to see which scripts run,
and how long they take to finish.
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp index dcfe0b870b..4cb96d3532 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <LibCore/ElapsedTimer.h> #include <LibJS/Interpreter.h> #include <LibWeb/HTML/Scripting/ClassicScript.h> @@ -51,13 +52,16 @@ NonnullRefPtr<ClassicScript> ClassicScript::create(String filename, StringView s // https://html.spec.whatwg.org/multipage/webappapis.html#run-a-classic-script JS::Value ClassicScript::run(RethrowErrors rethrow_errors) { + dbgln("ClassicScript: Running script {}", filename()); (void)rethrow_errors; + auto timer = Core::ElapsedTimer::start_new(); auto interpreter = JS::Interpreter::create_with_existing_realm(m_script_record->realm()); interpreter->run(interpreter->global_object(), m_script_record->parse_node()); auto& vm = interpreter->vm(); if (vm.exception()) vm.clear_exception(); + dbgln("ClassicScript: Finished running script {}, Duration: {}ms", filename(), timer.elapsed()); return vm.last_value(); } |