Re: [PATCH v2 6/7] trace2: add stopwatch timers
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 13, 2022, 21:12 UTC
- Message-ID
- <xmqq8rlje8cu.fsf@gitster.g>
- In-Reply-To
- <dd6d8e2841b424ba89672b4d94306f9ec882a868.1665600750.git.gitgitgadget@gmail.com>
"Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 9 quoted lines
> From: Jeff Hostetler <jeffhost@microsoft.com> > > Add stopwatch timer mechanism to Trace2. > > trace2/tr2_tmr.c | 182 +++++++++++++++++++++++++ > trace2/tr2_tmr.h | 140 +++++++++++++++++++ > 15 files changed, 784 insertions(+) > create mode 100644 trace2/tr2_tmr.c > create mode 100644 trace2/tr2_tmr.h
Whew. That's a lot of new code and doc to make two calls to getnanotime() and accumulate the differences.
It was irritating to count zeros in the same constant 1000000000.0 spelled out 9 times. Perhaps something like
#define NS_TO_SECONDS(ns) ((double)(ns) / (1000*1000*1000.))
would have helped?
Other than that, all looked reasonable.
Thanks.