From owner-freebsd-arm@FreeBSD.ORG Sun Oct 20 23:01:06 2013 Return-Path: Delivered-To: freebsd-arm@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3F9324FD; Sun, 20 Oct 2013 23:01:06 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from gromit.grondar.org (grandfather.grondar.org [IPv6:2a01:348:0:15:5d59:5c20:0:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 03F5626A6; Sun, 20 Oct 2013 23:01:06 +0000 (UTC) Received: from graveyard.grondar.org ([88.96.155.33] helo=gronkulator.grondar.org) by gromit.grondar.org with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.80.1 (FreeBSD)) (envelope-from ) id 1VY1za-0002Ru-Tt; Mon, 21 Oct 2013 00:01:04 +0100 Subject: Re: ARM counter registers and get_cyclecount() Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Content-Type: multipart/signed; boundary="Apple-Mail=_FE892B73-F41E-414B-8EE8-D6837A37D3F2"; protocol="application/pgp-signature"; micalg=pgp-sha512 From: Mark Robert Vaughan Murray In-Reply-To: <1382309355.92499.127.camel@revolution.hippie.lan> Date: Mon, 21 Oct 2013 00:01:02 +0100 Message-Id: <25608D4E-C299-498A-8F77-3548D711F419@FreeBSD.org> References: <0D53AF4E-9EC4-42E1-8D9E-1ECB87A9CCE6@FreeBSD.org> <1382306602.92499.117.camel@revolution.hippie.lan> <78B77E93-BE2E-4CA2-9D1B-F994B795FABB@FreeBSD.org> <1382309355.92499.127.camel@revolution.hippie.lan> To: Ian Lepore X-Mailer: Apple Mail (2.1510) X-SA-Score: -1.0 Cc: freebsd-arm X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2013 23:01:06 -0000 --Apple-Mail=_FE892B73-F41E-414B-8EE8-D6837A37D3F2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 20 Oct 2013, at 23:49, Ian Lepore wrote: >> Last time I looked at binuptime(), it was not nearly as good in the = low bits due to quantisation error. >>=20 >=20 > Could you be thinking of getbinuptime()? It returns the time as of = the > last tick, but binuptime() goes all the way to the hardware to return > the time right now (and it handles counter rollover and such). There > may be faster clocks available, which still gives get_cyclecount() = some > value, but binuptime() as a fallback implementation isn't horrible if > the timecounter is already using the fastest clock available (or at > least using one that's reasonable fast). I'm thinking of the numbers I see when I print the output of = get_cyclecount() while harvesting stochastic events on various = platforms. > I think we've been here before, but: get_cyclecount() is a HORRIBLE > name. I would be fairly reluctant to implement that using a clock = that > runs slower than the cpu clock, because you'd just be lying, and = nothing > about the name makes it clear that the result might be something other > than what the name promises. (And there aren't many arm SoCs that = have > a counter that fast.) Sigh. I'm not nearly as concerned with the name as I am with getting the = fastest available hardware counter as I can find. > There are other complexities that come to mind... things like clocks > that run slower or even stop in power-saving modes, is that a problem? Yup :-(. But if its fast and the highest-resolution non-quantised timing = available, I guess I'll use it. What I don't want is numbers with lots = of low bits being non random/skipped; I'd rather have a slower counter = still incrementing from the bottom bit up. If its running at = CPU/Instruction clock speed, it will do. M --=20 Mark R V Murray --Apple-Mail=_FE892B73-F41E-414B-8EE8-D6837A37D3F2 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.20 (Darwin) Comment: GPGTools - http://gpgtools.org iQCVAwUBUmRgrt58vKOKE6LNAQqkJgQAsCspAT5s5BZa6xgfwbmYyfFXNcgDPt4/ 4BPvr1f0/PjZ8kN/DIAkLConfAfY4QlVnPCwSuKTE6w60Uj8GAkjkrndd4aP3ogY pkWOQUxzPwPXsPIhUpSo2zcb1PKdtIObr/hL44k69kLMjDQpSnb5VWbN58+WWlut gcgSZaI4lr8= =WX+l -----END PGP SIGNATURE----- --Apple-Mail=_FE892B73-F41E-414B-8EE8-D6837A37D3F2--