BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
Timing Class Reference
Inheritance diagram for Timing:
Collaboration diagram for Timing:

Public Member Functions

 __construct (array $params=[])
 
 setLogger (LoggerInterface $logger)
 
 mark ($markName)
 
 clearMarks ($markName=null)
 
 measure ($measureName, $startMark= 'requestStart', $endMark=null)
 
 getEntries ()
 
 getEntriesByType ($entryType)
 
 getEntryByName ($name)
 

Protected Attributes

 $logger
 

Detailed Description

An interface to help developers measure the performance of their applications. This interface closely matches the W3C's User Timing specification. The key differences are:

  • The reference point for all measurements which do not explicitly specify a start time is $_SERVER['REQUEST_TIME_FLOAT'], not navigationStart.
  • Successive calls to mark() and measure() with the same entry name cause the previous entry to be overwritten. This ensures that there is a 1:1 mapping between names and entries.
  • Because there is a 1:1 mapping, instead of getEntriesByName(), we have getEntryByName().

The in-line documentation incorporates content from the User Timing Specification https://www.w3.org/TR/user-timing/ Copyright © 2013 World Wide Web Consortium, (MIT, ERCIM, Keio, Beihang). https://www.w3.org/Consortium/Legal/2015/doc-license

Since
1.27

Member Function Documentation

Timing::clearMarks (   $markName = null)
Parameters
string$markNameThe name of the mark that should be cleared. If not specified, all marks will be cleared.
Timing::getEntries ( )
Returns
array[] All entries in chronological order.
Timing::getEntriesByType (   $entryType)
Parameters
string$entryType
Returns
array[] Entries (in chronological order) that have the same value for the entryType attribute as the $entryType parameter.
Timing::getEntryByName (   $name)
Parameters
string$name
Returns
array|null Entry named $name or null if it does not exist.
Timing::mark (   $markName)

Store a timestamp with the associated name (a "mark")

Parameters
string$markNameThe name associated with the timestamp. If there already exists an entry by that name, it is overwritten.
Returns
array The mark that has been created.
Timing::measure (   $measureName,
  $startMark = 'requestStart',
  $endMark = null 
)

This method stores the duration between two marks along with the associated name (a "measure").

If neither the startMark nor the endMark argument is specified, measure() will store the duration from $_SERVER['REQUEST_TIME_FLOAT'] to the current time. If the startMark argument is specified, but the endMark argument is not specified, measure() will store the duration from the most recent occurrence of the start mark to the current time. If both the startMark and endMark arguments are specified, measure() will store the duration from the most recent occurrence of the start mark to the most recent occurrence of the end mark.

Parameters
string$measureName
string$startMark
string$endMark
Returns
array|bool The measure that has been created, or false if either the start mark or the end mark do not exist.
Timing::setLogger ( LoggerInterface  $logger)

Sets a logger instance on the object.

Parameters
LoggerInterface$logger
Returns
null

Implements Psr\Log\LoggerAwareInterface.


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