Re: [PATCH v3 7/8] trace2: add stopwatch timers
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 20, 2022, 20:25 UTC
- Message-ID
- <xmqq7d0us0o2.fsf@gitster.g>
- In-Reply-To
- <8e701109976777ad8fae1e0cd3908bb11a1fcf93.1666290489.git.gitgitgadget@gmail.com>
"Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 5 quoted lines
> +#define NS_PER_SEC_D ((double)1000*1000*1000) > ... > + double t_total = ((double)timer->total_ns) / NS_PER_SEC_D; > + double t_min = ((double)timer->min_ns) / NS_PER_SEC_D; > + double t_max = ((double)timer->max_ns) / NS_PER_SEC_D;
Hmph, it certainly is an improvement compared to the previous round, but was there a reason why we did not want a more concise
#define NS_TO_SECONDS(ns) ((double)(ns) / (1000*1000*1000.))
double t_total = NS_TO_SECONDS(timer->total_ns); double t_min = NS_TO_SECONDS(timer->min_ns); double t_max = NS_TO_SECONDS(timer->max_ns);
that does not need to repeat (double) all over?
Not worth a reroll by itself. Just wanted to know the reasoning behind it, as I suspect I am missing the reason why it is good to explicitly casting with (double) in some places; the above does not look like one, though.
Thanks.