Functions

Closure()

Closure() 

createPackager()

createPackager($original_file, $options) 

Parameters

$original_file

$options

Generate a XHProf Display View given the various URL parameters as arguments. The first argument is an object that implements the iXHProfRuns interface.

displayXHProfReport(object $xhprof_runs_impl, array $url_params, string $source, string $run, string $wts, string $symbol, $sort, string $run1, string $run2) 

Parameters

$xhprof_runs_impl

object

An object that implements the iXHProfRuns interface .

$url_params

array

Array of non-default URL params.

$source

string

Category/type of the run. The source in combination with the run id uniquely determines a profiler run.

$run

string

run id, or comma separated sequence of run ids. The latter is used if an aggregate report of the runs is desired.

$wts

string

Comma separate list of integers. Represents the weighted ratio in which which a set of runs will be aggregated. [Used only for aggregate reports.]

$symbol

string

Function symbol. If non-empty then the parent/child view of this function is displayed. If empty, a flat-profile view of the functions is displayed.

$sort

$run1

string

Base run id (for diff reports)

$run2

string

New run id (for diff reports)

Generates a tabular report for all functions. This is the top-level report.

full_report($url_params, $symbol_tab, $sort, $run1, $run2) 

author Kannan

Parameters

$url_params

$symbol_tab

$sort

$run1

$run2

Given a number, returns the td class to use for display.

get_print_class($num, $bold) 

For instance, negative numbers in diff reports comparing two runs (run1 & run2) represent improvement from run1 to run2. We use green to display those deltas, and red for regression deltas.

Parameters

$num

$bold

Return attribute names and values to be used by javascript tooltip.

get_tooltip_attributes($type, $metric) 

Parameters

$type

$metric

Initialize the metrics we'll display based on the information in the raw data.

init_metrics($xhprof_data, $rep_symbol, $sort, $diff_report) 

author Kannan

Parameters

$xhprof_data

$rep_symbol

$sort

$diff_report

Print info for a parent or child function in the parent & children report.

pc_info($info, $base_ct, $base_info, $parent) 

author Kannan

Parameters

$info

$base_ct

$base_info

$parent

Computes percentage for a pair of values, and returns it in string format.

pct($a, $b) 

Parameters

$a

$b

Generate the profiler report for diff mode (delta between two runs).

profiler_diff_report($url_params, $xhprof_data1, $run1_desc, $xhprof_data2, $run2_desc, $rep_symbol, $sort, $run1, $run2) 

author Kannan

Parameters

$url_params

$xhprof_data1

$run1_desc

$xhprof_data2

$run2_desc

$rep_symbol

$sort

$run1

$run2

Analyze raw data & generate the profiler report (common for both single run mode and diff mode).

profiler_report($url_params, $rep_symbol, $sort, $run1, $run1_desc, $run1_data, $run2, $run2_desc, $run2_data) 

author : Kannan

Parameters

$url_params

$rep_symbol

$sort

$run1

$run1_desc

$run1_data

$run2

$run2_desc

$run2_data

Generate the profiler report for a single run.

profiler_single_run_report($url_params, $xhprof_data, $run_desc, $rep_symbol, $sort, $run) 

author Kannan

Parameters

$url_params

$xhprof_data

$run_desc

$rep_symbol

$sort

$run

Callback comparison operator (passed to usort() for sorting array of tuples) that compares array elements based on the sort column specified in $sort_col (global parameter).

sort_cbk($a, $b) 

author Kannan

Parameters

$a

$b

Get the appropriate description for a statistic (depending upon whether we are in diff report mode or single run report mode).

stat_description($stat) 

author Kannan

Parameters

$stat

Generates a report for a single function/symbol.

symbol_report($url_params, $run_data, $symbol_info, $sort, $rep_symbol, $run1, $symbol_info1, $run2, $symbol_info2) 

author Kannan

Parameters

$url_params

$run_data

$symbol_info

$sort

$rep_symbol

$run1

$symbol_info1

$run2

$symbol_info2

Get raw data corresponding to specified array of runs aggregated by certain weightage.

xhprof_aggregate_runs(object $xhprof_runs_impl, array $runs, array $wts, string $source, bool $use_script_name) : array

Suppose you have run:5 corresponding to page1.php, run:6 corresponding to page2.php, and run:7 corresponding to page3.php and you want to accumulate these runs in a 2:4:1 ratio. You can do so by calling: xhprof_aggregate_runs(array(5, 6, 7), array(2, 4, 1)); The above will return raw data for the runs aggregated in 2:4:1 ratio.

author Kannan

Parameters

$xhprof_runs_impl

object

An object that implements the iXHProfRuns interface

$runs

array

run ids of the XHProf runs..

$wts

array

integral (ideally) weights for $runs

$source

string

source to fetch raw data for run from

$use_script_name

bool

If true, a fake edge from main() to to __script:: is introduced in the raw data so that after aggregations the script name is still preserved.

Returns

arrayReturn aggregated raw data

Set one key in an array and return the array

xhprof_array_set($arr, $k, $v) 

author Kannan

Parameters

$arr

$k

$v

Removes/unsets one key in an array and return the array

xhprof_array_unset($arr, $k) 

author Kannan

Parameters

$arr

$k

Given parent & child function name, composes the key in the format present in the raw data.

xhprof_build_parent_child_key($parent, $child) 

author Kannan

Parameters

$parent

$child

Hierarchical diff: Compute and return difference of two call graphs: Run2 - Run1.

xhprof_compute_diff($xhprof_data1, $xhprof_data2) 

author Kannan

Parameters

$xhprof_data1

$xhprof_data2

Analyze hierarchical raw data, and compute per-function (flat) inclusive and exclusive metrics.

xhprof_compute_flat_info(array $raw_data, array $overall_totals) : array

Also, store overall totals in the 2nd argument.

author Kannan Muthukkaruppan

Parameters

$raw_data

array

XHProf format raw profiler data.

$overall_totals

array

&$overall_totals OUT argument for returning overall totals for various metrics.

Returns

arrayReturns a map from function name to its call count and inclusive & exclusive metrics (such as wall time, etc.).

Compute inclusive metrics for function. This code was factored out of xhprof_compute_flat_info().

xhprof_compute_inclusive_times($raw_data) : array

The raw data contains inclusive metrics of a function for each unique parent function it is called from. The total inclusive metrics for a function is therefore the sum of inclusive metrics for the function across all parents.

author Kannan

Parameters

$raw_data

Returns

arrayReturns a map of function name to total (across all parents) inclusive metrics for the function.

xhprof_count_format()

xhprof_count_format($num) 

Parameters

$num

xhprof_error()

xhprof_error($message) 

Parameters

$message

Generate DOT script from the given raw phprof data.

xhprof_generate_dot_script(\raw_data, $raw_data, \threshold, $threshold, \page, $source, \func, $page, \critical_path, $func, $critical_path, $right, $left) 

returns , string, the DOT script to generate image.
author cjiang

Parameters

$raw_data

\raw_data,

phprof profile data.

$threshold

\threshold,

float, the threshold value [0,1). The functions in the raw_data whose exclusive wall times ratio are below the threshold will be filtered out and won't apprear in the generated image.

$source

\page,

string(optional), the root node name. This can be used to replace the 'main()' as the root node.

$page

\func,

string, the focus function.

$func

\critical_path,

bool, whether or not to display critical path with bold lines.

$critical_path

$right

$left

Generate image according to DOT script. This function will spawn a process with "dot" command and pipe the "dot_script" to it and pipe out the generated image content.

xhprof_generate_image_by_dot(\dot_script, $dot_script, \type, $type) 

returns , binary content of the generated image on success. empty string on failure.
author cjiang

Parameters

$dot_script

\dot_script,

string, the script for DOT to generate the image.

$type

\type,

one of the supported image types, see $xhprof_legal_image_types.

Genearte and send MIME header for the output image to client browser.

xhprof_generate_mime_header($type, $length) 

author cjiang

Parameters

$type

$length

Extracts value for a boolean param $param from query string. If param is not specified, return the $default value.

xhprof_get_bool_param($param, $default) 

If value is not a valid unsigned integer, logs error and returns null.

author Kannan

Parameters

$param

$default

xhprof_get_children_table()

xhprof_get_children_table($raw_data) 

Parameters

$raw_data

Generate image content from phprof run id.

xhprof_get_content_by_run(object $xhprof_runs_impl, \run_id, $run_id, \type, $type, \threshold, $threshold, \func, $func, $source, $critical_path) 

returns , string, the DOT script to generate image.
author cjiang

Parameters

$xhprof_runs_impl

object

An object that implements the iXHProfRuns interface

$run_id

\run_id,

integer, the unique id for the phprof run, this is the primary key for phprof database table.

$type

\type,

string, one of the supported image types. See also $xhprof_legal_image_types.

$threshold

\threshold,

float, the threshold value [0,1). The functions in the raw_data whose exclusive wall times ratio are below the threshold will be filtered out and won't apprear in the generated image.

$func

\func,

string, the focus function.

$source

$critical_path

Extracts value for a float param $param from query string. If param is not specified, return the $default value.

xhprof_get_float_param($param, $default) 

If value is not a valid unsigned integer, logs error and returns null.

author Kannan

Parameters

$param

$default

Given a partial query string $q return matching function names in specified XHProf run. This is used for the type ahead function selector.

xhprof_get_matching_functions($q, $xhprof_data) 

author Kannan

Parameters

$q

$xhprof_data

xhprof_get_metrics()

xhprof_get_metrics($xhprof_data) 

Parameters

$xhprof_data

Internal helper function used by various xhprof_get_param* flavors for various types of parameters.

xhprof_get_param_helper(string $param) 

author Kannan

Parameters

$param

string

name of the URL query string param

xhprof_get_possible_metrics()

xhprof_get_possible_metrics() 

Extracts value for string param $param from query string. If param is not specified, return the $default value.

xhprof_get_string_param($param, $default) 

author Kannan

Parameters

$param

$default

Extracts value for unsigned integer param $param from query string. If param is not specified, return the $default value.

xhprof_get_uint_param($param, $default) 

If value is not a valid unsigned integer, logs error and returns null.

author Kannan

Parameters

$param

$default

Send an HTTP header with the response. You MUST use this function instead of header() so that we can debug header issues because they're virtually impossible to debug otherwise. If you try to commit header(), SVN will reject your commit.

xhprof_http_header(string $name, string $value) 

Parameters

$name

string

HTTP header name, like 'Location'

$value

string

HTTP header value, like 'http://www.example.com/'

Generate references to required stylesheets & javascript.

xhprof_include_js_css($ui_dir_url_path) 

If the calling script (such as index.php) resides in a different location that than 'xhprof_html' directory the caller must provide the URL path to 'xhprof_html' directory so that the correct location of the style sheets/javascript can be specified in the generated HTML.

Parameters

$ui_dir_url_path

Takes raw XHProf data that was aggregated over "$num_runs" number of runs averages/nomalizes the data. Essentially the various metrics collected are divided by $num_runs.

xhprof_normalize_metrics($raw_data, $num_runs) 

author Kannan

Parameters

$raw_data

$num_runs

Initialize params from URL query string. The function creates globals variables for each of the params and if the URL query string doesn't specify a particular param initializes them with the corresponding default value specified in the input.

xhprof_param_init($params) 

params array $params An array whose keys are the names of URL params who value needs to be retrieved from the URL query string. PHP globals are created with these names. The value is itself an array with 2-elems (the param type, and its default value). If a param is not specified in the query string the default value is used.
author Kannan

Parameters

$params

Takes a parent/child function name encoded as "a==>b" and returns array("a", "b").

xhprof_parse_parent_child($parent_child) 

author Kannan

Parameters

$parent_child

xhprof_percent_format()

xhprof_percent_format($s, $precision) 

Parameters

$s

$precision

xhprof_prune_run()

xhprof_prune_run($raw_data, $prune_percent) 

Parameters

$raw_data

$prune_percent

Implodes the text for a bunch of actions (such as links, forms, into a HTML list and returns the text.

xhprof_render_actions($actions) 

Parameters

$actions

xhprof_render_diff_image()

xhprof_render_diff_image($xhprof_runs_impl, $run1, $run2, $type, $threshold, $source) 

Parameters

$xhprof_runs_impl

$run1

$run2

$type

$threshold

$source

Generate image from phprof run id and send it to client.

xhprof_render_image(object $xhprof_runs_impl, \run_id, $run_id, \type, $type, \threshold, $threshold, \func, $func, \bool, $source, $critical_path) 

author cjiang

Parameters

$xhprof_runs_impl

object

An object that implements the iXHProfRuns interface

$run_id

\run_id,

integer, the unique id for the phprof run, this is the primary key for phprof database table.

$type

\type,

string, one of the supported image types. See also $xhprof_legal_image_types.

$threshold

\threshold,

float, the threshold value [0,1). The functions in the raw_data whose exclusive wall times ratio are below the threshold will be filtered out and won't apprear in the generated image.

$func

\func,

string, the focus function.

$source

\bool,

does this run correspond to a PHProfLive run or a dev run?

$critical_path

Return a trimmed version of the XHProf raw data. Note that the raw data contains one entry for each unique parent/child function combination.The trimmed version of raw data will only contain entries where either the parent or child function is in the list of $functions_to_keep.

xhprof_trim_run(array $raw_data, array $functions_to_keep) : array

Note: Function main() is also always kept so that overall totals can still be obtained from the trimmed version.

author Kannan

Parameters

$raw_data

array

XHProf raw data

$functions_to_keep

array

array of function names

Returns

arrayTrimmed XHProf Report

Checks if XHProf raw data appears to be valid and not corrupted.

xhprof_valid_run($run_id, array $raw_data) : bool

@param int $run_id Run id of run to be pruned. [Used only for reporting errors.]

author Kannan

Parameters

$run_id

$raw_data

array

XHProf raw data to be pruned /p>

Returns

booltrue on success, false on failure

Classes and interfaces

IMarkdownParser

« More »

iXHProfRuns

iXHProfRuns interface for getting/saving a XHProf run.

« More »

ClassLoader

ClassLoader implements an PSR-0 class loader

« More »

XHProfRuns_Default

XHProfRuns_Default is the default implementation of the iXHProfRuns interface for saving/fetching XHProf runs.

« More »

MarkdownExtraParser

« More »

MarkdownParser

« More »

MarkdownExtraParserTest

« More »

MarkdownParserTest

« More »

UnifiedAssetInstaller

« More »

Attribute

Class representing a single GraphViz attribute.

« More »

AttributeTest

Test for the the class representing a GraphViz attribute.

« More »

Edge

Class representing an edge (arrow, line).

« More »

Exception

Class representing an exception in this GraphViz component.

« More »

Graph

Class representing a graph; this may be a main graph but also a subgraph.

« More »

Node

Class representing a node / element in a graph.

« More »

DocBlock

Parses the DocBlock for any structure.

« More »

DocBlockTest

Test class for phpDocumentor_Reflection_DocBlock

« More »

LongDescription

Parses a Long Description of a DocBlock.

« More »

Tag

Parses a tag definition for a DocBlock.

« More »

CoversTag

Reflection class for a @covers tag in a Docblock.

« More »

CoversTagTest

Test class for phpDocumentor_Reflection_DocBlock_Tag_Covers

« More »

LinkTag

Reflection class for a @link tag in a Docblock.

« More »

LinkTagTest

Test class for \phpDocumentor\Reflection\DocBlock\Tag\LinkTag

« More »

MethodTag

Reflection class for a {@method} in a Docblock.

« More »

MethodTagTest

Test class for \phpDocumentor\Reflection\DocBlock\Tag\MethodTag

« More »

ParamTag

Reflection class for a {@param} tag in a Docblock.

« More »

PropertyReadTag

Reflection class for a {@property} tag in a Docblock.

« More »

PropertyTag

Reflection class for a {@property} tag in a Docblock.

« More »

PropertyWriteTag

Reflection class for a {@property} tag in a Docblock.

« More »

ReturnTag

Reflection class for a {@return} tag in a Docblock.

« More »

SeeTag

Reflection class for a {@see} tag in a Docblock.

« More »

SeeTagTest

Test class for phpDocumentor_Reflection_DocBlock_Tag_See

« More »

ThrowTag

Reflection class for a mistyped @throws tag called @throw in a Docblock.

« More »

ThrowsTag

Reflection class for a {@throws} tag in a Docblock.

« More »

UsesTag

Reflection class for a {@uses} tag in a Docblock.

« More »

UsesTagTest

Test class for phpDocumentor_Reflection_DocBlock_Tag_Uses

« More »

VarTag

Reflection class for a {@var} tag in a Docblock.

« More »

VarTagTest

Test class for phpDocumentor_Reflection_DocBlock_Tag_Link

« More »

Constants

 

XHPROF_BOOL_PARAM

XHPROF_BOOL_PARAM 

 

XHPROF_FLOAT_PARAM

XHPROF_FLOAT_PARAM 

 

Type definitions for URL params

XHPROF_STRING_PARAM 

 

XHPROF_UINT_PARAM

XHPROF_UINT_PARAM 

Classes and interfaces

phpDocumentor_GraphViz_NodeTest

Test for the the class representing a GraphViz node.

« More »