|  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
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 Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: github at fabian-franz dot de
New email:
PHP Version: OS:


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

As already described here, simple test scripts do fail:

( See below )

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

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:

$raw = xhprof_disable();

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 test.php
[apples-macbook-pro:~] Apple% $HOME/php/bin/php test.php
[apples-macbook-pro:~] Apple% $HOME/php/bin/php test.php

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

Expected result:

It should be close to int(3000000).

Actual result:


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

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-12 18:01 UTC]
-Assigned To: +Assigned To: scottmac
 [2017-10-24 06:11 UTC]
-Status: Assigned +Status: Open -Assigned To: scottmac +Assigned To:
 [2017-10-24 08:24 UTC]
-Status: Open +Status: Suspended
 [2017-10-24 08:24 UTC]
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-2023 The PHP Group
All rights reserved.
Last updated: Wed Dec 06 00:01:28 2023 UTC