Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Dec 2016 01:29:06 +0100
From:      Goran =?utf-8?B?TWVracSH?= <meka@tilda.center>
To:        Ian Lepore <ian@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: How to use sem_timedwait?
Message-ID:  <20161215002906.mllorgvvuovbdtze@hal9000.meka.no-ip.org>
In-Reply-To: <1481748960.1889.398.camel@freebsd.org>
References:  <20161214074228.zh6q5zya2gszw4g6@hal9000.meka.no-ip.org> <1481748960.1889.398.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--hrhuntinyslroab3
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Dec 14, 2016 at 01:56:00PM -0700, Ian Lepore wrote:
> On Wed, 2016-12-14 at 08:42 +0100, Goran Meki=C4=87 wrote:
> One of the things you did with that code is measured how much time it
> took to format and print the "It should have ended..." line. =C2=A0If you
> want to capture how long you were asleep you need the clock_gettime()
> to be the next thing you call after sem_timedwait(). =C2=A0Even the time =
to
> access errno may be non-trivial if it's actually a thread-local
> variable.
>
> If you want to get better sleep-timing performance (at the expense of
> less power-saving efficiency), try setting
>
> =C2=A0 sysctl kern.timecounter.alloweddeviation=3D0
>
> That will prevent the aggregation of timeouts scheduled near each other
> to all happen at the same time, resulting in more wakeups, each of
> which is more accurate (more wakeups =3D more power used).
>
> -- Ian
>

This is exactly what I've needed. Thank you so much. If you can tell me any=
 other tip to make the difference even smaller, I'd be grateful. Currently,=
 it goes from 0.1ms to 1ms. Great improvement! Once more, thank you very mu=
ch!

Regards,
meka

--hrhuntinyslroab3
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE1WIFkXy2ZeMKjjKEWj1TknovrLYFAlhR488ACgkQWj1Tknov
rLbjixAAnqaNtBOX9tv04Udv5UX6gN947P2fSOnTz0/VBKl2Mlu24uRtJ3AL/Bhl
VWn2mJiS4zR/ty/S4bajCso+rJwjTEeo9PJ7TGA9j0RmSXWht4K+V2lJH0dZKWCD
FOKAJWkZVQugcv+ESzw3AXmzGe8mXoyivcPAa9Wr+Irt8U7U+9OckhrOTTghJ9EL
n+PrtYf9DKpsugjaJ5NWKrTdASIYOyjIxXuUaW5hdHV5f5+Q5ZOx4PK8XJkM5YvK
2d9/HZfFRyFby+8+Exy6/9cTkaxaQgTNjcKhXgCOq7rn1gYxfbKol8WyG9LQmF24
cibW+frmX9Xi2uvB4E9Sr8qs3TPz2hhfD0Qgfnhlbmk3th9q7gmk++kf+tPDoJwG
QzjA0qaJufrFEwVz7/faZb2S8wuGr8U/TMTwXPlMOAmAdxcHq0iT7GpTpua6ix11
MKi+s7FWSvr0r5n0QZvuLFoLK9y7h+Bl4lAfdpDopc1V4NCkeF+/A1LmqBDVc2uR
TG4IAfmw7OY4A+tb7sYnXboQBOH3k7bdBUJD31TTEq+WveOdRAzazAjY88sGVt2p
ZxlJ6ZPlRchxMmncRqh4HsM0aa+UYCRdwJElmvfOPwtj/X4xcjVCvKRolPpjRL7Y
lJTw6WHukvqAf0Fwi7mq7Cpb65oZRC6kPM3OJ/fmN7cFyelO5m4=
=GzqM
-----END PGP SIGNATURE-----

--hrhuntinyslroab3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161215002906.mllorgvvuovbdtze>