Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/xhprof/xhprof_lib/utils/xhprof_lib.php File Reference

Go to the source code of this file.

Enumerations

enum  XHPROF_STRING_PARAM
enum  XHPROF_UINT_PARAM
enum  XHPROF_FLOAT_PARAM
enum  XHPROF_BOOL_PARAM

Functions

 xhprof_error ($message)
 xhprof_get_possible_metrics ()
 init_metrics ($xhprof_data, $rep_symbol, $sort, $diff_report=false)
 xhprof_get_metrics ($xhprof_data)
 xhprof_parse_parent_child ($parent_child)
 xhprof_build_parent_child_key ($parent, $child)
 xhprof_valid_run ($run_id, $raw_data)
 xhprof_trim_run ($raw_data, $functions_to_keep)
 xhprof_normalize_metrics ($raw_data, $num_runs)
 xhprof_aggregate_runs ($xhprof_runs_impl, $runs, $wts, $source="phprof", $use_script_name=false)
 xhprof_compute_flat_info ($raw_data, &$overall_totals)
 xhprof_compute_diff ($xhprof_data1, $xhprof_data2)
 xhprof_compute_inclusive_times ($raw_data)
 xhprof_prune_run ($raw_data, $prune_percent)
 xhprof_array_set ($arr, $k, $v)
 xhprof_array_unset ($arr, $k)
 xhprof_get_param_helper ($param)
 xhprof_get_string_param ($param, $default= '')
 xhprof_get_uint_param ($param, $default=0)
 xhprof_get_float_param ($param, $default=0)
 xhprof_get_bool_param ($param, $default=false)
 xhprof_param_init ($params)
 xhprof_get_matching_functions ($q, $xhprof_data)

Enumeration Type Documentation

Definition at line 730 of file xhprof_lib.php.

Definition at line 729 of file xhprof_lib.php.

Type definitions for URL params

Definition at line 727 of file xhprof_lib.php.

Definition at line 728 of file xhprof_lib.php.


Function Documentation

init_metrics ( xhprof_data,
rep_symbol,
sort,
diff_report = false 
)

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

Author:
Kannan

Definition at line 50 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

xhprof_aggregate_runs ( xhprof_runs_impl,
runs,
wts,
source = "phprof",
use_script_name = false 
)

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_implAn object that implements the iXHProfRuns interface
array$runsrun ids of the XHProf runs..
array$wtsintegral (ideally) weights for $runs
string$sourcesource to fetch raw data for run from
bool$use_script_nameIf true, a fake edge from main() to to __script::<scriptname> is introduced in the raw data so that after aggregations the script name is still preserved.
Returns:
array Return aggregated raw data
Author:
Kannan

Definition at line 320 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

xhprof_array_set ( arr,
k,
v 
)

Set one key in an array and return the array

Author:
Kannan

Definition at line 709 of file xhprof_lib.php.

Here is the caller graph for this function:

xhprof_array_unset ( arr,
k 
)

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

Author:
Kannan

Definition at line 719 of file xhprof_lib.php.

Here is the caller graph for this function:

xhprof_build_parent_child_key ( parent,
child 
)

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

Author:
Kannan

Definition at line 165 of file xhprof_lib.php.

Here is the caller graph for this function:

xhprof_compute_diff ( xhprof_data1,
xhprof_data2 
)

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

Author:
Kannan

Definition at line 516 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

xhprof_compute_flat_info ( raw_data,
&$  overall_totals 
)

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

Also, store overall totals in the 2nd argument.

Parameters:
array$raw_dataXHProf format raw profiler data.
array&$overall_totalsOUT argument for returning overall totals for various metrics.
Returns:
array Returns a map from function name to its call count and inclusive & exclusive metrics (such as wall time, etc.).
Author:
Kannan Muthukkaruppan

Definition at line 454 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

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

Definition at line 567 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

xhprof_error ( message)

Definition at line 22 of file xhprof_lib.php.

Here is the caller graph for this function:

xhprof_get_bool_param ( param,
default = false 
)

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.

Author:
Kannan

Definition at line 834 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

xhprof_get_float_param ( param,
default = 0 
)

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.

Author:
Kannan

Definition at line 807 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Author:
Kannan

Definition at line 921 of file xhprof_lib.php.

Here is the call graph for this function:

xhprof_get_metrics ( xhprof_data)

Definition at line 125 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
stringname of the URL query string param
Author:
Kannan

Definition at line 742 of file xhprof_lib.php.

Here is the caller graph for this function:

Definition at line 32 of file xhprof_lib.php.

Here is the caller graph for this function:

xhprof_get_string_param ( param,
default = '' 
)

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

Author:
Kannan

Definition at line 759 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

xhprof_get_uint_param ( param,
default = 0 
)

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.

Author:
Kannan

Definition at line 778 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Author:
Kannan

Definition at line 268 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

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

Definition at line 886 of file xhprof_lib.php.

Here is the call graph for this function:

xhprof_parse_parent_child ( parent_child)

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

Author:
Kannan

Definition at line 148 of file xhprof_lib.php.

Here is the caller graph for this function:

xhprof_prune_run ( raw_data,
prune_percent 
)

Definition at line 639 of file xhprof_lib.php.

Here is the call graph for this function:

xhprof_trim_run ( raw_data,
functions_to_keep 
)

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:
arrayXHProf raw data
arrayarray of function names
Returns:
array Trimmed XHProf Report
Author:
Kannan

Definition at line 240 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

xhprof_valid_run ( run_id,
raw_data 
)

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

Parameters:
int$run_idRun id of run to be pruned. [Used only for reporting errors.]
array$raw_dataXHProf raw data to be pruned & validated.
Returns:
bool true on success, false on failure
Author:
Kannan

Definition at line 186 of file xhprof_lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations