php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #77307 $_SERVER['PHP_HRTIME_INTEGER']
Submitted: 2018-12-17 07:54 UTC Modified: 2022-05-13 16:07 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: bugzilla77 at gmail dot com Assigned:
Status: Wont fix Package: Date/time related
PHP Version: 7.3.0 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugzilla77 at gmail dot com
New email:
PHP Version: OS:

 

 [2018-12-17 07:54 UTC] bugzilla77 at gmail dot com
Description:
------------
Please add to $_SERVER array:
key: REQUEST_HRTIME_FLOAT
value: hrtime(true)

Test script:
---------------
<?php
 // PHP 7.2

 // ... page
 // ... code

 $elapsed=$_SERVER['REQUEST_TIME_FLOAT']-microtime(true);

?>

<?php
 // PHP 7.3

 // ... page
 // ... code

 $elapsed=$_SERVER['REQUEST_HRTIME_FLOAT']-hrtime(true);

?>

Expected result:
----------------
$_SERVER['REQUEST_HRTIME_FLOAT'] returns hrtime(true) of script start


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-12-17 10:57 UTC] bugzilla77 at gmail dot com
-Summary: $_SERVER['REQUEST_HRTIME_FLOAT'] +Summary: $_SERVER['REQUEST_HRTIME_INTEGER']
 [2018-12-17 10:57 UTC] bugzilla77 at gmail dot com
REQUEST_HRTIME_FLOAT -> REQUEST_HRTIME_INTEGER
 [2018-12-17 11:22 UTC] spam2 at rhsoft dot net
do you realize that this values are not from php at all but from the webserver?

it is not the script start but when the request arrived at the webserver, easily to see when you use your own startup value at the begin of the application and so you can even measure how expensive php initialization is
 [2018-12-17 12:26 UTC] bugzilla77 at gmail dot com
If $_SERVER['REQUEST_TIME_FLOAT'] is computed by php engine based on data from the server, you can compute $_SERVER['REQUEST_HRTIME_INTEGER'] too.
 [2018-12-17 12:38 UTC] spam2 at rhsoft dot net
http://php.net/manual/en/function.hrtime.php

how can "hrtime — Get the system's high resolution time" be computed?
https://elinux.org/High_Resolution_Timers
 [2018-12-17 12:47 UTC] bugzilla77 at gmail dot com
What about
$_SERVER['PHP_HRTIME_INTEGER']
?

You would not have to encode
$start = hrtime(true);
in each script.
 [2018-12-17 12:53 UTC] bugzilla77 at gmail dot com
-Summary: $_SERVER['REQUEST_HRTIME_INTEGER'] +Summary: $_SERVER['PHP_HRTIME_INTEGER']
 [2018-12-17 12:53 UTC] bugzilla77 at gmail dot com
REQUEST_HRTIME_INTEGER -> PHP_HRTIME_INTEGER
 [2018-12-17 13:43 UTC] spam2 at rhsoft dot net
to save one line code which by far is not needed in every script additional overhead for each request - to gain what?
 [2018-12-17 13:52 UTC] bugzilla77 at gmail dot com
95% of the data available in $ _SERVER are not needed in every script, but exists and overheads.
 [2018-12-17 13:56 UTC] bugzilla77 at gmail dot com
There are known scripts that do not use the $_SERVER array at all. Will we remove it because it overheads?
 [2018-12-17 14:22 UTC] spam2 at rhsoft dot net
foolish argumentation - they are SERVER vars provided by httpd anyways and they are not populated if not used thanks to http://www.php.net/manual/en/ini.core.php#ini.auto-globals-jit

what is your damned problem writing one line of code in the one out of thousand scripts you need it?
 [2018-12-17 14:26 UTC] spam2 at rhsoft dot net
DISCLAIMER: i am NOT a php upstream developer, just annoyed by stupid feature requests in a bug tracker where even component / package is not proper selected and the first change of subject shows that no second of considering was invested
 [2018-12-17 14:29 UTC] bugzilla77 at gmail dot com
So, what is your damned problem writing

$start=microtime(true);
// ...
print($start);

instead of

// ...
print($_SERVER['REQUEST_TIME_FLOAT']);


Do not you see this one and unnecessary global variable?

In a moment you will write that I can create a class for it. Bravo.
 [2018-12-17 14:43 UTC] bugzilla77 at gmail dot com
>> DISCLAIMER: i am NOT a php upstream developer...
You are not, but Anatol Bielski is!

Anatol Belski <notifications@github.com>: good idea. Please file a feature request to bugs.php.net to track and discuss. We still need to care about 32-bit. Thanks.

https://github.com/php/php-src/commit/83497327e747703300d35831b4aa94adf1120165
 [2018-12-17 15:40 UTC] spam2 at rhsoft dot net
AGAIN: the current variables comign from httpd *for free*

don't you unerstand that system calls and rhings which can't be resolved at compile time one and for all are *expensive* und for hyperfast applications the startup time of php is learday a problem because it's a large amout of the request?

CMS CACHED:               499 us
STATIC PHP:               434 us
STATIC HTM:               386 us
 [2018-12-20 10:19 UTC] danack@php.net
bugzilla77 - apologies for the inappropriate responses.

Harald, please can you stop posting on this site unless you have vital information that no-one else in the world has. It is not appropriate to berate other users of PHP.
 [2022-05-13 16:07 UTC] derick@php.net
-Status: Open +Status: Wont fix
 [2022-05-13 16:07 UTC] derick@php.net
Values in $_SERVER should be provided by the web server. The web servers generally don't provide an 'hrtime', so I'm closing this as "won't fix".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC