By default, when I profile a page request with xDebug, I get output that looks something like this
19.2468 51097384 -> is_string() /path/to/app/code/core/Mage/Eav/Model/Entity/Abstract.php:363
19.2469 51097336 -> Mage_Eav_Model_Entity_Abstract->getAttribute() /path/to/app/code/core/Mage/Eav/Model/Entity/Abstract.php:513
19.2469 51097384 -> is_numeric() /path/to/app/code/core/Mage/Eav/Model/Entity/Abstract.php:352
19.2469 51097384 -> is_string() /path/to/app/code/core/Mage/Eav/Model/Entity/Abstract.php:363
19.2470 51097336 -> Mage_Eav_Model_Entity_Abstract->getAttribute() /path/to/app/code/core/Mage/Eav/Model/Entity/Abstract.php:513
19.2470 51097384 -> is_numeric() /path/to/app/code/core/Mage/Eav/Model/Entity/Abstract.php:352
19.2471 51097384 -> is_string() /path/to/app/code/core/Mage/Eav/Model/Entity/Abstract.php:363
19.2949 50464472 -> Zend_Log->__destruct() /path/to/lib/Zend/Log.php:513
19.2950 50464472 -> Zend_Log_Writer_Stream->shutdown() /path/to/lib/Zend/Log.php:285
Are there any xdebug flags, or other features, for reporting on the object type for a particular call? That is, when the report contains this line
Mage_Eav_Model_Entity_Abstract->getAttribute()
it's telling me the getAttribute method, defined in the Mage_Eav_Model_Entity_Abstract
, is being called. In addition to the above information, I'd like to know what type of object is having its getAttribute method called.
My end goal is to know a bit more, at glance, about which objects are consuming large amounts of memory in a system. Right now, once I've identified a large jump in memory consumption, I'll add some debugging code to the root methods using memory_get_usage
which will let me identify the object with a get_class($this);
call. This works, but adds time and mental overhead to the process. I want to know immediately after profiling which specific objects are responsible.
Update: Per the comments, if I run the following script via a web browser
<?php
xdebug_start_trace();
abstract class A
{
abstract function foo();
public function bar()
{
echo "A Test","\n";
}
}
class B extends A
{
public function foo()
{
}
}
$test = new B;
$test->bar();
xDebug reports the following in its trace file.
TRACE START [2012-03-18 22:15:30]
0.0248 643288 -> A->bar() /Users/alanstorm/Sites2011/magento1point6point1.dev/xdebug.php:21
0.0258 8512
TRACE END [2012-03-18 22:15:30]
What I want (and should, per the comments, expect?), is instead of
A->bar();
which lets me know the bar
method, defined in the A
class, was called, is
B->bar();
which would let me know the bar
method was called on an object which was instantiated with the class B.
Running on OS X 10.6.8 with the stock PHP, installed and upgraded via the stock pecl.
xdebug_call_function()
andxdebug_call_class
?