From 0c39f8128d17fe76283f678c56fbe48176a43069 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 11 Aug 2021 20:43:30 +0200 Subject: [PATCH] LibTest: Emit a profile signpost at the start of each test This makes it super easy to see which test is which when browsing a profile of the test runner. :^) --- Userland/Libraries/LibTest/JavaScriptTestRunner.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunner.h b/Userland/Libraries/LibTest/JavaScriptTestRunner.h index 24aa57c23f..e3c25343a6 100644 --- a/Userland/Libraries/LibTest/JavaScriptTestRunner.h +++ b/Userland/Libraries/LibTest/JavaScriptTestRunner.h @@ -35,6 +35,10 @@ #include #include +#if __serenity__ +# include +#endif + #define STRCAT(x, y) __STRCAT(x, y) #define STRSTRCAT(x, y) __STRSTRCAT(x, y) #define __STRCAT(x, y) x #y @@ -250,6 +254,11 @@ inline JSFileResult TestRunner::run_file_test(const String& test_path) { g_currently_running_test = test_path; +#ifdef __serenity__ + auto string_id = perf_register_string(test_path.characters(), test_path.length()); + perf_event(PERF_EVENT_SIGNPOST, string_id, 0); +#endif + double start_time = get_time_in_ms(); auto interpreter = JS::Interpreter::create(*g_vm);