diff options
-rw-r--r-- | Userland/Libraries/LibJS/Heap/Heap.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Heap/Heap.cpp b/Userland/Libraries/LibJS/Heap/Heap.cpp index a2c95203b6..d8fe220e8b 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.cpp +++ b/Userland/Libraries/LibJS/Heap/Heap.cpp @@ -96,7 +96,10 @@ void Heap::collect_garbage(CollectionType collection_type, bool print_report) perf_event(PERF_EVENT_SIGNPOST, gc_perf_string_id, global_gc_counter++); #endif - auto collection_measurement_timer = Core::ElapsedTimer::start_new(); + Core::ElapsedTimer collection_measurement_timer; + if (print_report) + collection_measurement_timer.start(); + if (collection_type == CollectionType::CollectGarbage) { if (m_gc_deferrals) { m_should_gc_when_deferral_ends = true; @@ -304,9 +307,8 @@ void Heap::sweep_dead_cells(bool print_report, Core::ElapsedTimer const& measure }); } - int time_spent = measurement_timer.elapsed(); - if (print_report) { + Time const time_spent = measurement_timer.elapsed_time(); size_t live_block_count = 0; for_each_block([&](auto&) { ++live_block_count; @@ -315,7 +317,7 @@ void Heap::sweep_dead_cells(bool print_report, Core::ElapsedTimer const& measure dbgln("Garbage collection report"); dbgln("============================================="); - dbgln(" Time spent: {} ms", time_spent); + dbgln(" Time spent: {} ms", time_spent.to_milliseconds()); dbgln(" Live cells: {} ({} bytes)", live_cells, live_cell_bytes); dbgln("Collected cells: {} ({} bytes)", collected_cells, collected_cell_bytes); dbgln(" Live blocks: {} ({} bytes)", live_block_count, live_block_count * HeapBlock::block_size); |