\

Namespaces

Cilex
phpDocumentor

Interfaces

iXHProfRuns iXHProfRuns interface for getting/saving a XHProf run.

Classes

FeatureContext Context class for the phpDocumentor Features.
ExecutionContext Context class for the phpDocumentor Features.
CheckstyleContext Context class for the phpDocumentor Features.
XHProfRuns_Default XHProfRuns_Default is the default implementation of the iXHProfRuns interface for saving/fetching XHProf runs.

Constants

XHPROF_STRING_PARAM

XHPROF_STRING_PARAM

Type definitions for URL params

XHPROF_UINT_PARAM

XHPROF_UINT_PARAM

XHPROF_FLOAT_PARAM

XHPROF_FLOAT_PARAM

XHPROF_BOOL_PARAM

XHPROF_BOOL_PARAM

Functions

xhprof_include_js_css()

xhprof_include_js_css( $ui_dir_url_path)

Generate references to required stylesheets & javascript.

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

xhprof_count_format()

xhprof_count_format( $num)

Parameters

$num

xhprof_percent_format()

xhprof_percent_format( $s,  $precision)

Parameters

$s
$precision

xhprof_render_actions()

xhprof_render_actions( $actions)

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

Parameters

$actions

xhprof_render_link()

xhprof_render_link(\html-str $content, \raw-str $href, \raw-str $class, \raw-str $id, \raw-str $title, \raw-str $target, \raw-str $onclick, \raw-str $style, \raw-str $access, \raw-str $onmouseover, \raw-str $onmouseout, \raw-str $onmousedown)

Parameters

\html-str $content

the text/image/innerhtml/whatever for the link

\raw-str $href
\raw-str $class
\raw-str $id
\raw-str $title
\raw-str $target
\raw-str $onclick
\raw-str $style
\raw-str $access
\raw-str $onmouseover
\raw-str $onmouseout
\raw-str $onmousedown

sort_cbk()

sort_cbk( $a,  $b)

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).

Parameters

$a
$b

init_metrics()

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

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

Parameters

$xhprof_data
$rep_symbol
$sort
$diff_report

stat_description()

stat_description( $stat)

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

Parameters

$stat

profiler_report()

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

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

Parameters

$url_params
$rep_symbol
$sort
$run1
$run1_desc
$run1_data
$run2
$run2_desc
$run2_data

pct()

pct( $a,  $b)

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

Parameters

$a
$b

get_print_class()

get_print_class( $num,  $bold)

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

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

print_td_num()

print_td_num( $num,  $fmt_func,  $bold,  $attributes)

Prints a <td> element with a numeric value.

Parameters

$num
$fmt_func
$bold
$attributes

print_td_pct()

print_td_pct( $numer,  $denom,  $bold,  $attributes)

Prints a <td> element with a pecentage.

Parameters

$numer
$denom
$bold
$attributes

print_function_info()

print_function_info( $url_params,  $info,  $sort,  $run1,  $run2)

Print "flat" data corresponding to one function.

Parameters

$url_params
$info
$sort
$run1
$run2

print_flat_data()

print_flat_data( $url_params,  $title,  $flat_data,  $sort,  $run1,  $run2,  $limit)

Print non-hierarchical (flat-view) of profiler data.

Parameters

$url_params
$title
$flat_data
$sort
$run1
$run2
$limit

full_report()

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

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

Parameters

$url_params
$symbol_tab
$sort
$run1
$run2

get_tooltip_attributes()

get_tooltip_attributes( $type,  $metric)

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

Parameters

$type
$metric

pc_info()

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

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

Parameters

$info
$base_ct
$base_info
$parent

print_pc_array()

print_pc_array( $url_params,  $results,  $base_ct,  $base_info,  $parent,  $run1,  $run2)

Parameters

$url_params
$results
$base_ct
$base_info
$parent
$run1
$run2

print_symbol_summary()

print_symbol_summary( $symbol_info,  $stat,  $base)

Parameters

$symbol_info
$stat
$base

symbol_report()

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

Generates a report for a single function/symbol.

Parameters

$url_params
$run_data
$symbol_info
$sort
$rep_symbol
$run1
$symbol_info1
$run2
$symbol_info2

profiler_single_run_report()

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

Generate the profiler report for a single run.

Parameters

$url_params
$xhprof_data
$run_desc
$rep_symbol
$sort
$run

profiler_diff_report()

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

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

Parameters

$url_params
$xhprof_data1
$run1_desc
$xhprof_data2
$run2_desc
$rep_symbol
$sort
$run1
$run2

displayXHProfReport()

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

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

Parameters

object $xhprof_runs_impl

An object that implements the iXHProfRuns interface .

array $url_params

Array of non-default URL params.

string $source

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

string $run

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

string $wts

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

string $symbol

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
string $run1

Base run id (for diff reports)

string $run2

New run id (for diff reports)

xhprof_http_header()

xhprof_http_header( $name,  $value)

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.

Parameters

$name
$value

xhprof_generate_mime_header()

xhprof_generate_mime_header( $type,  $length)

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

Parameters

$type
$length

xhprof_generate_image_by_dot()

xhprof_generate_image_by_dot( $dot_script,  $type)

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.

Parameters

$dot_script
$type

xhprof_get_children_table()

xhprof_get_children_table( $raw_data)

Parameters

$raw_data

xhprof_generate_dot_script()

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

Generate DOT script from the given raw phprof data.

Parameters

$raw_data
$threshold
$source
$page
$func
$critical_path
$right
$left

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

xhprof_get_content_by_run()

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

Generate image content from phprof run id.

Parameters

object $xhprof_runs_impl

An object that implements the iXHProfRuns interface

$run_id
$type
$threshold
$func
$source
$critical_path

xhprof_render_image()

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

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

Parameters

object $xhprof_runs_impl

An object that implements the iXHProfRuns interface

$run_id
$type
$threshold
$func
$source
$critical_path

xhprof_error()

xhprof_error( $message)

Parameters

$message

xhprof_get_possible_metrics()

xhprof_get_possible_metrics()

xhprof_get_metrics()

xhprof_get_metrics( $xhprof_data)

Parameters

$xhprof_data

xhprof_parse_parent_child()

xhprof_parse_parent_child( $parent_child)

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

Parameters

$parent_child

xhprof_build_parent_child_key()

xhprof_build_parent_child_key( $parent,  $child)

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

Parameters

$parent
$child

xhprof_valid_run()

xhprof_valid_run( $run_id, array $raw_data)

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

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

Parameters

$run_id
array $raw_data

XHProf raw data to be pruned & validated. @return bool true on success, false on failure @author Kannan

xhprof_trim_run()

xhprof_trim_run( $raw_data,  $functions_to_keep) : array

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.

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

Parameters

$raw_data
$functions_to_keep

Returns

array —

Trimmed XHProf Report

xhprof_normalize_metrics()

xhprof_normalize_metrics( $raw_data,  $num_runs)

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.

Parameters

$raw_data
$num_runs

xhprof_aggregate_runs()

xhprof_aggregate_runs(object $xhprof_runs_impl,  $runs,  $wts,  $source,  $use_script_name)

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

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.

Parameters

object $xhprof_runs_impl

An object that implements the iXHProfRuns interface @param array $runs run ids of the XHProf runs.. @param array $wts integral (ideally) weights for $runs @param string $source source to fetch raw data for run from @param bool $use_script_name 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. @return array Return aggregated raw data @author Kannan

$runs
$wts
$source
$use_script_name

xhprof_compute_flat_info()

xhprof_compute_flat_info(array $raw_data,  $overall_totals) : array

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

Also, store overall totals in the 2nd argument.

Parameters

array $raw_data

XHProf format raw profiler data.

$overall_totals

Returns

array —

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

xhprof_compute_diff()

xhprof_compute_diff( $xhprof_data1,  $xhprof_data2)

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

Parameters

$xhprof_data1
$xhprof_data2

xhprof_compute_inclusive_times()

xhprof_compute_inclusive_times( $raw_data) : array

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

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.

Parameters

$raw_data

Returns

array —

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

xhprof_prune_run()

xhprof_prune_run( $raw_data,  $prune_percent)

Parameters

$raw_data
$prune_percent

xhprof_array_set()

xhprof_array_set( $arr,  $k,  $v)

Set one key in an array and return the array

Parameters

$arr
$k
$v

xhprof_array_unset()

xhprof_array_unset( $arr,  $k)

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

Parameters

$arr
$k

xhprof_get_param_helper()

xhprof_get_param_helper( $param)

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

Parameters

$param

xhprof_get_string_param()

xhprof_get_string_param( $param,  $default)

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

Parameters

$param
$default

xhprof_get_uint_param()

xhprof_get_uint_param( $param,  $default)

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

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

Parameters

$param
$default

xhprof_get_float_param()

xhprof_get_float_param( $param,  $default)

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

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

Parameters

$param
$default

xhprof_get_bool_param()

xhprof_get_bool_param( $param,  $default)

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

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

Parameters

$param
$default

xhprof_param_init()

xhprof_param_init( $params)

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.

Parameters

$params

xhprof_get_matching_functions()

xhprof_get_matching_functions( $q,  $xhprof_data)

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

Parameters

$q
$xhprof_data

createPackager()

createPackager(string $original_file, string[] $options) : \PEAR_Error|\PEAR_PackageFileManager2

Creates a packager object with all basic options set.

Parameters

string $original_file

Path of the original package.xml.

string[] $options

Set of options to merge in.

Returns

\PEAR_Error|\PEAR_PackageFileManager2

shouldInheritPackage()

shouldInheritPackage() : void