From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
"Tang, Jun" <juntangc@amazon.com>
Cc: 'GNU C Library' <libc-alpha@sourceware.org>
Subject: Re: patch for hp-timing.h
Date: Fri, 3 Feb 2023 10:38:24 -0300 [thread overview]
Message-ID: <7f31125b-87db-336a-e088-1d5ae6a22aa3@linaro.org> (raw)
In-Reply-To: <PAWPR08MB89825143A8C77510EB33C9D783D79@PAWPR08MB8982.eurprd08.prod.outlook.com>
On 03/02/23 10:29, Wilco Dijkstra via Libc-alpha wrote:
> Hi Jun,
>
>> hp-timing is only used on benchtest today, but it can be used on other
>> measurements in the future.
>
> It can't as proposed below since this would overflow in ~16 seconds.
> We could improve this by removing the zero bits from the multiply
> and doing some shifts, maybe that will make the interval long enough
> for integer multiply. Otherwise I'd suggest the floating point version since
> it's not like the benchtests don't already use floating point.
>
> Cheers,
> Wilco
Do we really need to handle more than ~16 seconds for the hp-timing? It
is usually used along with a accumulator and I would expect that once you
need to measure more than 16s using clock_gettime works as expected.
>
> diff --git a/benchtests/Makefile b/benchtests/Makefile
> index 292976b26b..a624614207 100644
> --- a/benchtests/Makefile
> +++ b/benchtests/Makefile
> @@ -499,4 +499,5 @@ $(objpfx)bench-%.c: %-inputs $(bench-deps)
> cat $($*-INCLUDE); \
> fi; \
> $(PYTHON) scripts/bench.py $(patsubst %-inputs,%,$<); } > $@-tmp
> + cp -f $@-tmp $@-bak
>
> Unintended change I guess?
>
> mv -f $@-tmp $@
> diff --git a/sysdeps/aarch64/hp-timing.h b/sysdeps/aarch64/hp-timing.h
> index f7f7ac7cae..c699effe6a 100644
> --- a/sysdeps/aarch64/hp-timing.h
> +++ b/sysdeps/aarch64/hp-timing.h
> @@ -41,7 +41,7 @@ typedef uint64_t hp_timing_t;
> #define HP_TIMING_DIFF(Diff, Start, End) \
> ({ hp_timing_t freq; \
> __asm__ __volatile__ ("mrs %0, cntfrq_el0" : "=r" (freq)); \
> - (Diff) = ((End) - (Start)) * (UINT64_C(1000000000) / freq); \
> + (Diff) = (((End) - (Start)) * UINT64_C(1000000000)) / freq; \
> })
>
> #endif /* hp-timing.h */
next prev parent reply other threads:[~2023-02-03 13:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 13:29 Wilco Dijkstra
2023-02-03 13:38 ` Adhemerval Zanella Netto [this message]
2023-02-03 14:02 ` Tang, Jun
2023-02-06 16:53 ` Wilco Dijkstra
2023-02-06 19:34 ` Tang, Jun
2023-02-08 14:58 ` Wilco Dijkstra
-- strict thread matches above, loose matches on Subject: below --
2023-01-31 23:20 Tang, Jun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7f31125b-87db-336a-e088-1d5ae6a22aa3@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=Wilco.Dijkstra@arm.com \
--cc=juntangc@amazon.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).