Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
moodle_xhprofrun Class Reference

Custom implementation of iXHProfRuns. More...

Inheritance diagram for moodle_xhprofrun:
iXHProfRuns

Public Member Functions

 get_run ($run_id, $type, &$run_desc)
 Given one runid and one type, return the run data and some extra info in run_desc from DB.
 
 prepare_run ($url)
 
 save_run ($xhprof_data, $type, $run_id=null)
 Given some run data, one type and, optionally, one runid store the information in DB.
 
 set_reducedata (bool $reducedata)
 Enable or disable reducing profiling data.
 

Protected Member Functions

 reduce_run_data (array $info)
 Reduce the run data to a more manageable size.
 
 sum_calls ($sum, $data)
 
 xhprof_topo_sort (array $info)
 Sort the xhprof run pseudo-topologically, so all parents are always before their children.
 

Protected Attributes

bool bool $reducedata = false
 Decide if we want to reduce profiling data or no.
 
 $runid = null
 
 $timecreated = 0
 
 $totalcalls = 0
 
 $totalcputime = 0
 
 $totalexecutiontime = 0
 
 $totalmemory = 0
 
 $url = null
 

Detailed Description

Custom implementation of iXHProfRuns.

This class is one implementation of the iXHProfRuns interface, in charge of storing and retrieve profiling run data to/from DB (profiling table)

The interface only defines two methods to be defined: get_run() and save_run() we'll be implementing some more in order to keep all the rest of information in our runs properly handled.

Member Function Documentation

◆ get_run()

moodle_xhprofrun::get_run ( $run_id,
$type,
& $run_desc )

Given one runid and one type, return the run data and some extra info in run_desc from DB.

Note that $type is completely ignored

Implements iXHProfRuns.

◆ reduce_run_data()

moodle_xhprofrun::reduce_run_data ( array $info)
protected

Reduce the run data to a more manageable size.

This removes from the run data all the entries that are matching a group of regular expressions.

The main use is to remove all the calls between "__Mustache" functions, which don't provide any useful information and make the call-graph too complex to be handled.

Parameters
array$infoThe xhprof run data, original array.
Return values
arrayThe xhprof run data, reduced array.

◆ save_run()

moodle_xhprofrun::save_run ( $xhprof_data,
$type,
$run_id = null )

Given some run data, one type and, optionally, one runid store the information in DB.

Note that $type is completely ignored

Implements iXHProfRuns.

◆ set_reducedata()

moodle_xhprofrun::set_reducedata ( bool $reducedata)

Enable or disable reducing profiling data.

Parameters
bool$reducedataDecide if we want to reduce profiling data (true) or no (false).

◆ xhprof_topo_sort()

moodle_xhprofrun::xhprof_topo_sort ( array $info)
protected

Sort the xhprof run pseudo-topologically, so all parents are always before their children.

Note that this is not a proper, complex, recursive topological sorting algorithm, returning nodes that later have to be converted back to xhprof "pairs" but, instead, does the specific work to get those parent==>child (2 levels only) "pairs" sorted (parents always before children).

Parameters
array$infoThe xhprof run data, original array.
Return values
arrayThe xhprof run data, sorted array.

The documentation for this class was generated from the following file: