Php matusri xhprof custompanel

Post on 21-Jan-2015

1.823 views 1 download

Tags:

description

 

Transcript of Php matusri xhprof custompanel

XHProf custom panel(CakePHP DebugKit)

Masaki YOSHIDA

me

● Name: Masaki YOSHIDA● Age: 27● Twitter: @ReSTARTR● Blog: http://blog.restartr.com

Frameworks

● Usually use:● Original Framework● based on ZendFramework

XHProf

● Profiler● a function-level hierarchical profiler for PHP● has a simple HTML based navigational interface.● Create Callgraph●

● How to install● pecl install

CakePHP1.3 callgraph

Symfony2 callgraph

Lithium callgraph

DebugKit

● CakePHP plugin● Debug toolbar

● history,request,session,timer,sql logs, log, variables...

● custom panel

Custom panel

implement

•cakephp/

• app/

• controllers/• helloworld_controller.php

• plugins/• debug_kit/• xhprof/

• controllers/• components/

• toolbar.php• xhprof.php

• views/• plugins/

• debug_kit/• elements/

• xhprof_panel.ctp

Usage - controller

var $components = array(

'DebugKit.Toolbar' => array('panels' => array('xhprof')),

'Xhprof.Xhprof' => array('configs' => array(

'XHPROF_ROOT' => '/var/vhosts/xhprof',

'XHPROF_SOURCE_NAME' => "helloworld"

)),

);

Usage – action method

function index() {

$this->Xhprof->start();

$this->set('msg','hello world!.');

$this->Xhprof->end();

}

todo

● Refactoring● call graph panel

Thank you.