A parser for cachegrind files, generating an xml format for CI usage and graphviz .dot files
Latest commit 8aee3f8 Sep 1, 2010 @mfthomasbley mfthomasbley refactoring

README

PHP_CachegrindParser
--------------------

Usage: (version 1)
------------------

php cachegrindparser.php --in <file_in> --out <file_out>
                         --filter=nophp|include|depth=#|timethreshold=0.0#
                         --format xml|dot|svg|png
                         --parts=#,#
                         --exclude=<strings>
                         --include=<strings>
                         --quiet

Optional parameters: --filter, --parts, --exclude, --include, --quiet

Multiple filters: --filter=nophp --filter=include ...


Usage: (version 2, better performance, less features)
-----------------------------------------------------

php cachegrindparser2.php --in <file_in> --out <file_out>
                          --timethreshold=0.0#
                          --time_min=###
                          --format dot|svg|png
                          --db=<file_db>
                          --quiet

Note: Please be careful that some parameters require '=' as value separator.


Input file:
- Cachegrind output file (e.g. generated by xdebug, see http://github.com/mayflowergmbh/xdebug)

Output file:
- xml: XML content
- dot: Graphviz graph, see http://graphviz.org
- svg/png: Graphviz graph, saved as SVG / PNG (screen size)

Filters (optional):
- nophp: removes calls to internal PHP functions
- include: removes calls to include, require, include_once and require_once functions
- depth=#: removes calls that are more than a few steps away from the root node
- timethreshold=0.##: removes calls that make up for less than a given percentage of the
                     total time of the tree
- time_min=##: removes calls that make up for less than a given amount of time [unit: ns]

Parts (optional):
- extract only a range of parts from a multipart input file
- syntax: #first,#last
- example: 1,10 or 5,15

Exclude (optional):
- skip a part of a multi-part input file by matching a substring inside the part (e.g. function or filename)
- useful to exclude AJAX background requests (e.g. notifications)
- example: --exclude=myAjaxBackgroundFunction,myAjaxNotifyFunction

Include (optional):
- include only parts of a multi-part input file by matching a substring inside the part (e.g. function or filename)
- useful to analyze new functions and classes
- example: --include=myNewFunction,myNewClass

Quiet (optional):
- Don't print out progress information

DB filename (optional):
- use custom SQLite database filename (default: database.sqlite)

Convert Dot to SVG (see http://graphviz.org):
- output letter page size:
  dot -Gsize=11,7 -Gratio=compress -Gcenter=true -Tsvg -o<file_out_svg> <file_in_dot>

- output a0 page size:
  dot -Gsize=66,42 -Gratio=compress -Gcenter=true -Tsvg -o<file_out_svg> <file_in_dot>

- output screen size:
  dot -Tsvg -o<file_out_svg> <file_in_dot>

Requirements:
- PHP 5.3+
- Graphviz (SVG/PNG/JPG export only)