Top Banner
PHP code profiling using XDebug By Gennady Feldman June 16, 2009
12

Php Code Profiling Using X Debug

Sep 01, 2014

Download

Technology

Presented by Gennady Feldman at Web Peformance for PHP developers (NY Web Performance Meetup & NY PHP).

Xdebug is a very powerful PHP extension that should be in the toolbox of any PHP developer. In this quick presentation we will do a quick introduction into some of the things Xdebug is capable of and what it can do for you. We'll cover a number of Xdebug features like remote debugging and code profiling. Forget those print and echo statements as your debugging aids. Gennady will share some tips and tricks (time permitting) of how to be a more efficient and productive PHP developer.

http://www.nyphp.org/content/presentations/
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Php Code Profiling Using X Debug

PHP code profiling using XDebug

ByGennady Feldman

June 16, 2009

Page 2: Php Code Profiling Using X Debug

Overview

• Introduction• Profiling with Xdebug• Enabling Profiling in Xdebug• Summary• Q & A

Page 3: Php Code Profiling Using X Debug

Introduction

• Xdebug is a powerhouse extension for PHP.

• It has a ton of features like debugging, tracing, profiling and analyzing problems with PHP code.

• Today we will focus on some of it’s profiling abilities.

Page 4: Php Code Profiling Using X Debug

Profiling with Xdebug

• Xdebug can generate cachegrind files that contain profiling information.

• It can be used to find bottle-necks in your scripts. • You need a tool to read these files.• Some of your options are: WinCacheGrind,

KCacheGrind, webgrind.• These tools allow you to analyze script execution

(execution time breakdown, # function calls, etc).

Page 5: Php Code Profiling Using X Debug

WinCacheGrind

Page 6: Php Code Profiling Using X Debug

KCacheGrind Screenshot

Page 7: Php Code Profiling Using X Debug

WebGrind Screenshot

Page 8: Php Code Profiling Using X Debug

Enabling Profiling

– xdebug.profiler_append• Default: 0

– xdebug.profiler_enable• Default: 0

– xdebug.profiler_output_dir• Default: /tmp

– xdebug.profiler_output_name• Default: cachegrind.out.%p

Page 9: Php Code Profiling Using X Debug

Summary

• Xdebug is a very powerful extension with a ton of great features.

• We only covered one tiny thing that this extension can do.

• This is a MUST in development environment.

• Come see me speak at NYPHP August 25, 2009 covering Xdebug from A to X.

Page 10: Php Code Profiling Using X Debug

Resources

• Xdebug: http://www.xdebug.org• WinCacheGrind: http://sourceforge.net/projects/

wincachegrind/• KCacheGrind:

http://kcachegrind.sourceforge.net/• WebGrind: http://code.google.com/p/webgrind/• My blog: http://www.gena01.com/blog/

Page 11: Php Code Profiling Using X Debug
Page 12: Php Code Profiling Using X Debug

Q & A