From e04ef310ca6792456611ca9abe65a3ec4b345f2b Mon Sep 17 00:00:00 2001 From: David Ansari Date: Tue, 5 Mar 2024 14:34:47 +0100 Subject: [PATCH] Print startup time in millisecond instead of microsecond (cherry picked from commit 519123a88319d3596ef26382715bcb43c89c5816) --- deps/rabbit/src/rabbit.erl | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/deps/rabbit/src/rabbit.erl b/deps/rabbit/src/rabbit.erl index 6b9e465e87d5..bfd7965cbddf 100644 --- a/deps/rabbit/src/rabbit.erl +++ b/deps/rabbit/src/rabbit.erl @@ -403,20 +403,18 @@ run_prelaunch_second_phase() -> start_it(StartType) -> case spawn_boot_marker() of {ok, Marker} -> - T0 = erlang:timestamp(), ?LOG_INFO("RabbitMQ is asked to start...", [], #{domain => ?RMQLOG_DOMAIN_PRELAUNCH}), try - {ok, _} = application:ensure_all_started(rabbitmq_prelaunch, - StartType), - {ok, _} = application:ensure_all_started(rabbit, - StartType), - ok = wait_for_ready_or_stopped(), - - T1 = erlang:timestamp(), - ?LOG_INFO( - "Time to start RabbitMQ: ~tp us", - [timer:now_diff(T1, T0)]), + {Millis, ok} = timer:tc( + fun() -> + {ok, _} = application:ensure_all_started( + rabbitmq_prelaunch, StartType), + {ok, _} = application:ensure_all_started( + rabbit, StartType), + wait_for_ready_or_stopped() + end, millisecond), + ?LOG_INFO("Time to start RabbitMQ: ~b ms", [Millis]), stop_boot_marker(Marker), ok catch