Hello, please sign in or register
You are here: Home

WinCacheGrind and Xdebug

Profiling PHP scripts is a good way to waste the hours to grab milliseconds back. Face it if you're scaling your app for a million users and you haven't got a tenth of that then the challenge isn't coding really... is it. 

But hell its fun so i opened up CacheGrind with profiling stats spat out by xdebug for my companies website which runs some crufty PHP code.

I had a little setup in my php.ini.

zend_extension_ts=c:/wamp/php/ext/php_xdebug-2.0.3-5.1.7.dll
xdebug.profiler_enable=1
xdebug.profiler_output_dir=c:/tmp/xdebug

... which installs the module and defines the dump file location.

We can check its installed by searching for the xdebug module by including in a page <?php phpinfo();?>

Once my little (and pointless) PHP script was executed

<?php
function my(){
	foreach( range(1,1000) as $k )
		substr($k*100, 1,12);
}

$int_t1 = xdebug_time_index();

my();

echo xdebug_time_index() - $int_t1;
?>

I then opened up WinCacheGrind and loaded the cachegrind file created in the directory i'd specified. This all showed the number of times functions were called, and if significant, the number of milliseconds it took to execute.

References

http://www.xdebug.org/index.php

http://sourceforge.net/projects/wincachegrind/

 

 

Comments

Drew
Great
Created 22/12/08
0921maoqiuyun
cheap nba jerseys, http://www.nbajerseys.net/ jordan shoes, http:/...
Created 21/09/15
guoyanying
But the replica watches sentry reebok shoes knew abercrombie and fitch uk his
Created 07/10/15
1015maoqiuyun
coach outlet online, http://www.coachoutletonline-store.us.com/
Created 15/10/15
oakleysunglasses
“I canada goose outlet think it doesn’t swarovski jewelry bode very
Created 21/01/16
oakleysunglasses
“I canada goose outlet think it doesn’t swarovski jewelry bode very
Created 21/01/16
linpingping
The michael--kors.org.uk next ralph lauren outlet day patriots jersey Mrs
Created 01/03/16
clibin
Tyrion 5c cases watched her ray ban sunglasses read. His timber...
Created 18/04/16
chenyan
Bond grinned. pandora-bracciali.it "We bcbgmax.in.net only chaussure...
Created 15/06/16
wq123
This hilfiger outlet time swarovski jewelry something really timberland outlet strange, ...
Created 30/06/16
ninestab123
ninest123 One canada goose pas cher gucci outlet thing
Created 21/07/16
michael kors factory outlet
adidas nmd pandora bracelet
Created 16/05/17
Title*
Comment

Prove you are not a robot

To prove you are not a robot, please type in the six character code you see in the picture below
Security confirmation codeI can't see this!
Contact
Name*
Email never shown*
Home Page

Author

Andrew Dodson
Since:Feb 2007

Comment | flag

Categories

Bookmark and Share