30 December 2009 View Comments

PHP Profiling – XHProf

PHP Profiling – XHProf

binary code and magnifying glass
XHProf is a heriarcical profiler for PHP originally developed by Facebook and then opensourced. The raw data collection component is implemented in C (as a PHP extension). The reporting/UI layer is all in PHP. It is capable of reporting function-level inclusive and exclusive wall times, memory usage, CPU times and number of calls for each function. Additionally, it supports ability to compare two runs (hierarchical DIFF reports), or aggregate results from multiple runs.

Here are some of the reports that XHProf provides:

If you are looking for an article which gives you details on how to install this extension in Ubuntu and a quick runthrough of how to use this, Lorenzo Alberton has an excellent article on this at Profiling with XHProf. There’s also a good background article on XHProf and why Facebook developed this extension over at Facebook.

Links:
XHProf Documentation
XHProf on PECL
Profiling with XHProf

Image Credit: from Crestock Photos

Tags: ,
31 March 2009 View Comments

Scienta Zend Framework Debug Bar

Scienta Debug Bar

Scienta Debug Bar

Scienta ZF Debugbar is a useful tool to add to your sites running on Zend Framework to get server side information of the page being accessed. It’s quite simple to use – just download the code, place it in your PHP include path and use the following code in your bootstrap file to get the debug bar to appear at the end of your page:

$options = array(
   'database_adapter' =>  $dbAdapter, // or array of adapters
   'memory_usage' =>      TRUE, // default value shown
   'collect_view_vars' => TRUE,
   'sort_view_vars' =>    TRUE,
   'show_exceptions' =>   TRUE,
   'handle_errors' =>     FALSE
);
 
$scBar = new Scienta_Controller_Plugin_Debug($options);
$frontController = Zend_Controller_Front::getInstance();
$frontController->registerPlugin($scBar);

The debug bar also gives you quick access to:

  • the variables used in the page
  • errors generated in that page
  • Database queries and time taken (if you’re using the Zend DB libraries)
  • the time taken to execute the script and more.

Get more information on this at the project site: http://jokke.dk/software/scientadebugbar

Reblog this post [with Zemanta]

7 April 2008 View Comments

Replace print_r and var_dump with Krumo

Replace print_r and var_dump with Krumo

Krumo

Here’s a good replacement for your standard print_r and var_dump in PHP, Krumo beautifies and expands the functionality required for PHP debugging:

To put it simply, Krumo is a replacement for print_r() and var_dump(). By definition Krumo is a debugging tool (now for PHP5 only), which displays structured information about any PHP variable.

A lot of developers use print_r() and var_dump() in the means of debugging tools. Although they were intended to present human readable information about a variable, we can all agree that in general they are not. Krumo is an alternative: it does the same job, but it presents the information beautified using CSS and DHTML.

Apart from dumping variable data, the current version of Krumo also supports the following :

  • Print Backtrace
  • List all included files
  • List all functions
  • List all declared classes
  • List all constants

Project Page: Krumo: Version 2.0 of print_r(); and var_dump();
Demo Page: http://kaloyan.info/krumo/demo/index.php

Tags:
7 April 2008 View Comments

DamnIT – Find Javascript Errors

DamnIT Notification

DamnIT Notification

How would you like to get an email with the javascript error and debug info about that error as soon as a visitor on your site encounters it? DamnIT provides you just that service:

DamnIT is a free service that emails you when a user encounters a JavaScript error in your webpages.

To get DamnIT installed for your site, just signup for an account and call a JS script – this works fine for IE and Firefox. If you want to install DamnIT on other browsers, you’ll need to place try…catch blocks. Learn more about DamnIT over at: http://damnit.jupiterit.com/home/learn

Link : DamnIT: Javascript Error Handling

Tags: