PHP Class XHProfRuns_Default, xhprof

This modified version of the file uses a MySQL backend to store the data, it also stores additional information outside the run itself (beyond simply the run id) to make comparisons and run location easier
Author: Kannan
Author: Paul Reinheimer (http://blog.preinheimer.com)
Inheritance: implements iXHProfRuns
ファイルを表示 Open project: preinheimer/xhprof Class Usage Examples

Public Properties

Property Type Description
$prefix
$run_details

Protected Properties

Property Type Description
$db Db_Abstract

Public Methods

Method Description
__construct ( $dir = null )
getDbClass ( )
getDistinct ( $data )
getHardHit ( array $criteria ) : resource Obtains the pages that have been the hardest hit over the past N days, utalizing the getRuns() method.
getNextAssoc ( $resultSet )
getRunComparativeData ( string $url, string $c_url ) : array Get comparative information for a given URL and c_url, this information will be used to display stats like how many calls a URL has, average, min, max execution time, etc. This information is pushed into the global namespace, which is horribly hacky.
getRuns ( array $stats ) : resource This function gets runs based on passed parameters, column data as key, value as the value. Values are escaped automatically. You may also pass limit, order by, group by, or "where" to add those values, all of which are used as is, no escaping.
getUrlStats ( array $data ) : resource Get stats (pmu, ct, wt) on a url or c_url
get_run ( string $run_id, mixed $type, mixed &$run_desc ) : mixed Retreives a run from the database,
save_run ( string $xhprof_data, mixed $type, string $run_id = null, mixed $xhprof_details = null ) : string Save the run in the database.

Protected Methods

Method Description
calculatePercentile ( $details )
db ( )

Private Methods

Method Description
gen_run_id ( $type ) When setting the id column, consider the length of the prefix you're specifying in $this->prefix

Method Details

__construct() public method

public __construct ( $dir = null )

calculatePercentile() protected method

protected calculatePercentile ( $details )

db() protected method

protected db ( )

getDbClass() public static method

public static getDbClass ( )

getDistinct() public method

public getDistinct ( $data )

getHardHit() public method

Obtains the pages that have been the hardest hit over the past N days, utalizing the getRuns() method.
public getHardHit ( array $criteria ) : resource
$criteria array An associative array containing, at minimum, type, days, and limit
return resource The result set reprsenting the results of the query

getNextAssoc() public static method

public static getNextAssoc ( $resultSet )

getRunComparativeData() public method

Get comparative information for a given URL and c_url, this information will be used to display stats like how many calls a URL has, average, min, max execution time, etc. This information is pushed into the global namespace, which is horribly hacky.
public getRunComparativeData ( string $url, string $c_url ) : array
$url string
$c_url string
return array

getRuns() public method

This function gets runs based on passed parameters, column data as key, value as the value. Values are escaped automatically. You may also pass limit, order by, group by, or "where" to add those values, all of which are used as is, no escaping.
public getRuns ( array $stats ) : resource
$stats array Criteria by which to select columns
return resource

getUrlStats() public method

Get stats (pmu, ct, wt) on a url or c_url
public getUrlStats ( array $data ) : resource
$data array An associative array containing the limit you'd like to set for the queyr, as well as either c_url or url for the desired element.
return resource result set from the database query

get_run() public method

Retreives a run from the database,
public get_run ( string $run_id, mixed $type, mixed &$run_desc ) : mixed
$run_id string unique identifier for the run being requested
$type mixed
$run_desc mixed
return mixed

save_run() public method

Save the run in the database.
public save_run ( string $xhprof_data, mixed $type, string $run_id = null, mixed $xhprof_details = null ) : string
$xhprof_data string
$type mixed
$run_id string
$xhprof_details mixed
return string

Property Details

$db protected_oe property

protected Db_Abstract $db
return Db_Abstract

$prefix public_oe property

public $prefix

$run_details public_oe property

public $run_details