Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97753 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53144 invoked from network); 14 Jan 2017 16:08:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2017 16:08:02 -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:36064] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 52/08-00729-EDC4A785 for ; Sat, 14 Jan 2017 11:07:59 -0500 Received: by h1123647.serverkompetenz.net (Postfix, from userid 1006) id A2C84784AEF; Sat, 14 Jan 2017 17:07:55 +0100 (CET) Received: from w530phpdev (p54A76276.dip0.t-ipconnect.de [84.167.98.118]) (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 50A8D784AEE; Sat, 14 Jan 2017 17:07:53 +0100 (CET) To: "'Niklas Keller'" , "'Leigh'" Cc: "'Michael Wallner'" , "'PHP Internals'" , "'Bob Weinand'" , "'Daniel Lowrey'" References: <146cbb21-72cf-ed65-095a-43a7420482fc@php.net> <02c901d2684e$d1ee2a30$75ca7e90$@belski.net> In-Reply-To: Date: Sat, 14 Jan 2017 17:07:49 +0100 Message-ID: <013d01d26e80$5c916f30$15b44d90$@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/hgIT1qRnoP4UhAA= Content-Language: en-us Subject: RE: [PHP-DEV] Fwd: Monotonic Time From: anatol.php@belski.net ("Anatol Belski") Hi, > -----Original Message----- > From: Niklas Keller [mailto:me@kelunik.com] > Sent: Friday, January 13, 2017 4:46 PM > To: Leigh > Cc: Anatol Belski ; Michael Wallner = ; > PHP Internals ; Bob Weinand ; > Daniel Lowrey > Subject: Re: [PHP-DEV] Fwd: Monotonic Time >=20 > 2017-01-13 15:06 GMT+01:00 Leigh : >=20 > > On Fri, 13 Jan 2017 at 09:35 Niklas Keller wrote: > > > > > Hi Anatol, > > > > > > Do you think we should merge hrtime into core or add a simple > > > function > > just > > > like microtime() to ext/standard? > > > > > > Regards, Niklas > > > > > > > It would be great if it could be a simple function, however it is > > going to be difficult to produce something cross-platform and > > meaningful with a single function. (I know Anatol has written = portable > > code, I haven't looked at it but I assume it's wrapping the various = structs used > by i.e. > > performance counters, hrtime, etc.) > > > > I don't think we can get away from having an object-based > > implementation to wrap those internal structs, but I do think this = is > > a useful addition regardless of how it's presented. > > >=20 > With timer.c it's very easy to have it as one function, in fact it's a = simple static > method currently doing exactly what I think it should probably do in = core as a > function. >=20 > = http://svn.php.net/viewvc/pecl/hrtime/trunk/hrtime.c?revision=3D341600&vi= ew=3D > markup > < Line 416. >=20 The PerformanceCounter class from the hrtime ext allows to implement any = time measurement directly in PHP. It provides the most low level units = used by the system, the ticks. To convert ticks into actual time, the = tick frequency is required. The frequency can be actually hidden from = the implementation, or could be exposed to PHP. Exposing might be useful = for several reasons, fe if one would want to compare different systems. = Anyway, these are the base bricks. Niklas, about merging into core - not sure it needs the StopWatch class, = but maybe. The performance counter class, at the very low level, could = have more chance. Taking timer.c as base should be fine, too, even there = is a significant improved potential down to the ASM level later, though = very platform specific. In first place what would make sense to know - = what exact usage would it be? More specific use case info is what is = needed to discuss and figure out the required implementation. Regards Anatol