[xdebug-general] Nonsensical profile?

From: Marcus Bointon <marcus[@]bointon.com>
Date: Sun, 3 Sep 2006 02:23:45 +0100

I have a little example script for illustrating kCacheGrind's
displays, but it's producing some very odd results. I'm running
xdebug2 CVS with PHP 5.1.6 on OS X.

<?php
function sleep1() {sleep(1);}
function sleep2() {sleep(2);}
function sleep4() {sleep(4);}
function sleep8() {sleep(8);}
sleep1();
sleep2();
sleep4();
sleep8();
?>

I would expect {main} to have about 0 self time, and each of sleep1-
sleep8 to take up approximately 8/15, 4/15/ 2/15 and 1/15 of the
remaining time. The callee map should look roughly like this:

+--------+----+--+-+
| | | | |
| | | | |
+--------+----+--+-+

What I'm actually getting is {main} self taking 48%, sleep1 taking
around 21%, and sleep2 11%, sleep4 and sleep8 taking about 9% each,
and all much smaller than sleep1! In all of the functions, the
internal calls to php:sleep take the same amount of time!! Graph is
roughly like this:

+------------------+
| main |
+------------------+
| | | | |
+---------+--+--+--+

What's going on? That makes no sense to me. Does sleep stop the
timers or something odd like that? I'm pretty sure I had this giving
expected results before.

Here's the profile:

==================
version: 0.9.6
cmd: /Users/marcus/Sites/sleeptest.php
part: 1

events: Time Memory

fl=php:internal
fn=php::sleep
6 1280 0

fl=/Users/marcus/Sites/sleeptest.php
fn=sleep1
2 1510 40
cfn=php::sleep
calls=1 0 0
6 1280 0

fl=php:internal
fn=php::sleep
7 279 0

fl=/Users/marcus/Sites/sleeptest.php
fn=sleep2
3 1160 0
cfn=php::sleep
calls=1 0 0
7 279 0

fl=php:internal
fn=php::sleep
8 239 0

fl=/Users/marcus/Sites/sleeptest.php
fn=sleep4
4 1009 0
cfn=php::sleep
calls=1 0 0
8 239 0

fl=php:internal
fn=php::sleep
9 240 0

fl=/Users/marcus/Sites/sleeptest.php
fn=sleep8
5 990 0
cfn=php::sleep
calls=1 0 0
9 240 0

fl=/Users/marcus/Sites/sleeptest.php
fn={main}

summary: 13090 49592

0 6379 40
cfn=sleep1
calls=1 0 0
2 2790 0
cfn=sleep2
calls=1 0 0
3 1440 0
cfn=sleep4
calls=1 0 0
4 1249 0
cfn=sleep8
calls=1 0 0
5 1230 0

========

Any idea what's wrong?

Marcus

-- 
Marcus Bointon
marcus@bointon.com | http://www.bointon.com/
Received on Sun Sep 03 2006 - 03:23:53 BST

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST