Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98215 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50417 invoked from network); 6 Feb 2017 12:33:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2017 12:33:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=anatol.php@belski.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=anatol.php@belski.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain belski.net from 85.214.73.107 cause and error) X-PHP-List-Original-Sender: anatol.php@belski.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:36320] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/24-30708-E0D68985 for ; Mon, 06 Feb 2017 07:33:19 -0500 Received: by h1123647.serverkompetenz.net (Postfix, from userid 1006) id 9CDC3784B7C; Mon, 6 Feb 2017 13:33:15 +0100 (CET) Received: from w530phpdev (p54A77A2C.dip0.t-ipconnect.de [84.167.122.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by h1123647.serverkompetenz.net (Postfix) with ESMTPSA id 412C1784B7C; Mon, 6 Feb 2017 13:33:13 +0100 (CET) To: "'Niklas Keller'" Cc: "'Leigh'" , "'Michael Wallner'" , "'PHP Internals'" , "'Bob Weinand'" , "'Daniel Lowrey'" References: <146cbb21-72cf-ed65-095a-43a7420482fc@php.net> <02c901d2684e$d1ee2a30$75ca7e90$@belski.net> <013d01d26e80$5c916f30$15b44d90$@belski.net> In-Reply-To: Date: Mon, 6 Feb 2017 13:33:09 +0100 Message-ID: <019301d28075$2efdce40$8cf96ac0$@belski.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQG2APfuj27eyiyn6X74ZL08hYdWAAF/HnI7ArG79kgBt17lbwLNShRmARVka/sCTNF/hgIT1qRnAmSbHhQBwapXtwFFxQcfoPgcJtA= Content-Language: en-us Subject: RE: [PHP-DEV] Fwd: Monotonic Time From: anatol.php@belski.net ("Anatol Belski") Hi Niklas, > -----Original Message----- > From: Niklas Keller [mailto:me@kelunik.com] > Sent: Sunday, February 5, 2017 8:19 PM > To: Anatol Belski > Cc: Leigh ; Michael Wallner ; PHP = Internals > ; Bob Weinand ; Daniel Lowrey > > Subject: Re: [PHP-DEV] Fwd: Monotonic Time >=20 > I have implemented a `hrtime()` function which allows access to the = system's > monotonic time in nanoseconds. >=20 Nice for the start. >=20 > https://github.com/php/php-src/compare/master...kelunik:hrtime >=20 >=20 > Feedback is very welcome. >=20 > I'm not sure whether we should allow a parameter for the time unit or = just let > the user do the simple calculation. >=20 I'd see this integration a bit different, as the goal is to put it into = the core. Here some quick points to maybe think about - on the m4 side, symbols need to be checked - the PHP internal and user stuff should be integrated tight into the = timer.c file,=20 - a finer usage with the concrete platform should be taken care of, thus = avoiding unnecessary function calls and conversions back/forth as you = can use - there might be a situation, where the monotonic API could be used = internally before modules are initialized - the symbols exported need to be renamed, probably prefix with = php_monotonic_*, like php_monotonic_timer_current(), etc. - but aso, probably not all the symbols should be exported With the names and API, probably some more clarity should be. AFM, the = low level units should be exposed, rather than a concrete time. Also, = the name hrtime() is probably not much speaking. Maybe these three? sys_get_monotonic_ticks() sys_get_monotonic_freq() sys_get_monotonic_nanotime() or even - sys_get_monotonic_time(int $unit = =3D NANOSECOND) Regarding to "sys_get_*" scheme with these. But in general, probably = nanoseconds were enough for the general case and fast, the pure ticks = were for the advanced usage. In general, probably for the core it should be done a more robust way, = some parts on the original lib should get more error checks and = improved. It would be probably more handy to discuss the further on the = PR page. Regards Anatol