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

Static class monitors performance of upgrade steps. More...

Static Public Member Functions

static get_elapsed ()
 Gets the time since the record_start function was called, rounded to 2 digits.
 
static record_detail (string $detail, bool $showalways=false)
 Records time taken by a detail of the install process.
 
static record_end (bool $verbose=true)
 Records the end of the current upgrade item.
 
static record_savepoint ($version)
 Records current time at the end of a given numbered step.
 
static record_start (bool $installation=false)
 Records current time at the start of the current upgrade item, e.g.
 

Public Attributes

float const THRESHOLD = 1.0
 For details, only show if they take longer than a second.
 

Static Protected Attributes

static float $before
 Time at start of current upgrade (plugin/system)
 
static bool $installation = false
 Flag indicates whether this is an installation (=no savepoints)
 
static bool $isrecording = false
 Flag to indicate whether we are recording timestamps or not.
 
static float $lastdetail
 Time at end of last recorded savepoint or detail.
 

Detailed Description

Static class monitors performance of upgrade steps.

Member Function Documentation

◆ get_elapsed()

static core_upgrade_time::get_elapsed ( )
static

Gets the time since the record_start function was called, rounded to 2 digits.

Return values
floatElapsed time

◆ record_detail()

static core_upgrade_time::record_detail ( string $detail,
bool $showalways = false )
static

Records time taken by a detail of the install process.

Time is only displayed if longer than threshold, and if in developer debug mode.

Parameters
string$detailText e.g. file or function name
bool$showalwaysIf true, shows time even if quick

◆ record_end()

static core_upgrade_time::record_end ( bool $verbose = true)
static

Records the end of the current upgrade item.

Parameters
bool$verboseIf true, displays output

◆ record_savepoint()

static core_upgrade_time::record_savepoint ( $version)
static

Records current time at the end of a given numbered step.

Parameters
float$versionVersion number (may have decimals, or not)

◆ record_start()

static core_upgrade_time::record_start ( bool $installation = false)
static

Records current time at the start of the current upgrade item, e.g.

plugin.

Parameters
bool$installationTrue if this is an installation (of this item) not upgrade

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