Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97754 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56035 invoked from network); 14 Jan 2017 17:00:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2017 17:00:11 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.160 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.160 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.160] ([81.169.146.160:34340] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/68-00729-6195A785 for ; Sat, 14 Jan 2017 12:00:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1484413201; l=7989; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=t8U1s+xyP/1hJQVg6rteGYPwj3ZpulUA+AQH20CMmGY=; b=TK/pgQ20gTGFNDI7/h6o7f5+JQdyOnbo0N+PHXbuQRQQhOEHO06TfXyCubv+hUo9FC VtBkHBt57Ii4GBKfiDlt9w/Cx/K0SOZxk79a4cSh32IF00hkM16WylJO765+c4oBBg93 ahz3+y05i/XvTSqefvPTd06vTxeluajqtLf4A= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNJBqD/sAU= X-RZG-CLASS-ID: mo00 Received: from mail-qt0-f170.google.com ([209.85.216.170]) by smtp.strato.de (RZmta 39.11 AUTH) with ESMTPSA id v089e4t0EH01T35 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp384r1 with 384 ECDH bits, eq. 7680 bits RSA)) (Client did not present a certificate) for ; Sat, 14 Jan 2017 18:00:01 +0100 (CET) Received: by mail-qt0-f170.google.com with SMTP id x49so72840694qtc.2 for ; Sat, 14 Jan 2017 09:00:01 -0800 (PST) X-Gm-Message-State: AIkVDXIdq24IIYKhYn2j8VPsJ7e0gsxU8OvmLOTGlBa7nv2mWZ+DLkBPTObPdLDcpM0pNrKiq2lmlxNelb3b+A== X-Received: by 10.200.48.14 with SMTP id f14mr18788143qte.236.1484413200919; Sat, 14 Jan 2017 09:00:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.141.204 with HTTP; Sat, 14 Jan 2017 09:00:00 -0800 (PST) In-Reply-To: <013d01d26e80$5c916f30$15b44d90$@belski.net> References: <146cbb21-72cf-ed65-095a-43a7420482fc@php.net> <02c901d2684e$d1ee2a30$75ca7e90$@belski.net> <013d01d26e80$5c916f30$15b44d90$@belski.net> Date: Sat, 14 Jan 2017 18:00:00 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Anatol Belski Cc: Leigh , Michael Wallner , PHP Internals , Bob Weinand , Daniel Lowrey Content-Type: multipart/alternative; boundary=001a1149c5f28a770a054610e1b8 Subject: Re: [PHP-DEV] Fwd: Monotonic Time From: me@kelunik.com (Niklas Keller) --001a1149c5f28a770a054610e1b8 Content-Type: text/plain; charset=UTF-8 > > 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 > > > > 2017-01-13 15:06 GMT+01:00 Leigh : > > > > > 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. > > > > > > > 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. > > > > http://svn.php.net/viewvc/pecl/hrtime/trunk/hrtime.c? > revision=341600&view= > > markup > > < Line 416. > > > 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. Hi Anatol, my specific use case is mainly for event loops, replacing the current microtime calls there, e.g. https://github.com/amphp/loop/blob/master/lib/NativeLoop.php#L62 Performance measuring is another one, but not that important to me. If microtime drifts there, it will show wrong results, but it won't impact applications with failures like executing DNS timeout watchers too early and making things fail. Regards, Niklas --001a1149c5f28a770a054610e1b8--