php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61132 [PATCH] Timing is totally wrong on Mac OS X with Speedstep Enabled
Submitted: 2012-02-18 05:55 UTC Modified: 2017-10-24 08:24 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: github at fabian-franz dot de Assigned:
Status: Suspended Package: xhprof (PECL)
PHP Version: 5.3.10 OS: Mac OS X 10.7.2
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: github at fabian-franz dot de
New email:
PHP Version: OS:

 

 [2012-02-18 05:55 UTC] github at fabian-franz dot de
Description:
------------
The xhprof tests related to timing fail on Mac OS X 10.7.2.

As already described here, simple test scripts do fail:

https://bugs.php.net/bug.php?id=58676

( See below )

This patch fixes the issue by using the provided mach timer apple framework:

https://developer.apple.com/library/mac/#qa/qa1398/_index.html

By using mach_absolute_time() and mach_timebase_info() the issue is fixed and the 
tests do pass on Mac OS X 10.7.2. (Sometimes they still fail, but before they had 
failed always).

Test script:
---------------
<?php

xhprof_enable();
sleep(3);
$raw = xhprof_disable();
var_dump($raw["main()"]["wt"]);

When I run this with your patch on Mac, a bunch of times, I expect to see walltime (wt) of about 3 Million microsecs. But the program prints fairly fluctuating numbers each time I run:

[apples-macbook-pro:~] Apple% $HOME/php/bin/php -dextension=xhprof.so test.php
int(1274841)
[apples-macbook-pro:~] Apple% $HOME/php/bin/php -dextension=xhprof.so test.php
int(2232810)
[apples-macbook-pro:~] Apple% $HOME/php/bin/php -dextension=xhprof.so test.php
int(1496259)

On Linux, we get numbers fairly close to 3000000 each time.

Expected result:
----------------
int(3000653)

It should be close to int(3000000).

Actual result:
--------------
int(1274841)

Patches

xhprof__mach_timer_patch_rtc_v2.diff (last revision 2012-02-18 05:56 UTC by github at fabian-franz dot de)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-12 18:01 UTC] sixd@php.net
-Assigned To: +Assigned To: scottmac
 [2017-10-24 06:11 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: scottmac +Assigned To:
 [2017-10-24 08:24 UTC] kalle@php.net
-Status: Open +Status: Suspended
 [2017-10-24 08:24 UTC] kalle@php.net
This package has not had a release for over 4 years, and the last bit of git activity was over 2 years ago, so I think its safe to say this extension is no longer in active development. If development picks back up, then please re-open this report
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 04 07:01:26 2024 UTC