TimeTracker implements SingletonInterface
Frontend Timetracking functions
Is used to register how much time is used with operations in TypoScript
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
- $currentHashPointer : array<string|int, mixed>
- $highlightLongerThan : int
- Log entries that take than this number of milliseconds (own time) will be highlighted during log display. Set 0 to disable highlighting.
- $LR : bool
- Log Rendering flag. If set, ->push() and ->pull() is called from the cObj->cObjGetSingle().
- $printConf : array<string|int, mixed>
- $starttime : int
- Is loaded with the millisecond time when this object is created
- $tsStack : array<string|int, mixed>
- $tsStackLevel : int
- $tsStackLevelMax : array<string|int, mixed>
- $tsStackLog : array<string|int, mixed>
- $tsStackPointer : int
- $uniqueCounter : int
- $wrapError : array<string|int, mixed>
- $wrapIcon : array<string|int, mixed>
- $finishtime : float
- Is set via finish() with the millisecond time when the request handler is finished.
- $isEnabled : bool
- If set to true (see constructor) then then the timetracking is enabled
Methods
- __construct() : mixed
- TimeTracker constructor.
- decStackPointer() : mixed
- Decreases the stack pointer
- finish() : void
- Usually called when the page generation and output is prepared.
- getDifferenceToStarttime() : int
- Gets the difference between a given microtime value and the starting time as milliseconds.
- getMilliseconds() : int
- Gets a microtime value as milliseconds value.
- getParseTime() : int
- Get total parse time in milliseconds
- incStackPointer() : mixed
- Increases the stack pointer
- printTSlog() : string
- Print TypoScript parsing log
- pull() : mixed
- Pulls an element from the TypoScript tracking array
- push() : mixed
- Pushes an element to the TypoScript tracking array
- setEnabled() : mixed
- setTSlogMessage() : mixed
- Logs the TypoScript entry
- setTSselectQuery() : mixed
- Set TSselectQuery - for messages in TypoScript debugger.
- start() : mixed
- Sets the starting time
- createHierarchyArray() : mixed
- Helper function for internal data manipulation
- fixCLen() : string
- Wraps the input content string in green colored span-tags IF the length of the input string exceeds $this->printConf['contentLength'] (or $this->printConf['contentLength_FILE'] if $v == "FILE"
- fixContent() : string
- Recursively generates the content to display
- fw() : string
- Wraps input string in a <span> tag
Properties
$currentHashPointer
public
array<string|int, mixed>
$currentHashPointer
= []
$highlightLongerThan
Log entries that take than this number of milliseconds (own time) will be highlighted during log display. Set 0 to disable highlighting.
public
int
$highlightLongerThan
= 0
$LR
Log Rendering flag. If set, ->push() and ->pull() is called from the cObj->cObjGetSingle().
public
bool
$LR
= true
This determines whether or not the TypoScript parsing activity is logged. But it also slows down the rendering
$printConf
public
array<string|int, mixed>
$printConf
= [
'showParentKeys' => 1,
'contentLength' => 10000,
// Determines max length of displayed content before it gets cropped.
'contentLength_FILE' => 400,
// Determines max length of displayed content FROM FILE cObjects before it gets cropped. Reason is that most FILE cObjects are huge and often used as template-code.
'flag_tree' => 1,
'flag_messages' => 1,
'flag_content' => 0,
'allTime' => 0,
'keyLgd' => 40,
]
$starttime
Is loaded with the millisecond time when this object is created
public
int
$starttime
= 0
$tsStack
public
array<string|int, mixed>
$tsStack
= [[]]
$tsStackLevel
public
int
$tsStackLevel
= 0
$tsStackLevelMax
public
array<string|int, mixed>
$tsStackLevelMax
= []
$tsStackLog
public
array<string|int, mixed>
$tsStackLog
= []
$tsStackPointer
public
int
$tsStackPointer
= 0
$uniqueCounter
public
int
$uniqueCounter
= 0
$wrapError
public
array<string|int, mixed>
$wrapError
= [
// the numeric items can be removed in TYPO3 v12.0.
0 => ['', ''],
1 => ['<strong>', '</strong>'],
2 => ['<strong style="color:#ff6600;">', '</strong>'],
3 => ['<strong style="color:#ff0000;">', '</strong>'],
\Psr\Log\LogLevel::INFO => ['', ''],
\Psr\Log\LogLevel::NOTICE => ['<strong>', '</strong>'],
\Psr\Log\LogLevel::WARNING => ['<strong style="color:#ff6600;">', '</strong>'],
\Psr\Log\LogLevel::ERROR => ['<strong style="color:#ff0000;">', '</strong>'],
]
$wrapIcon
public
array<string|int, mixed>
$wrapIcon
= [
// the numeric items can be removed in TYPO3 v12.0.
0 => '',
1 => 'actions-document-info',
2 => 'status-dialog-warning',
3 => 'status-dialog-error',
\Psr\Log\LogLevel::INFO => '',
\Psr\Log\LogLevel::NOTICE => 'actions-document-info',
\Psr\Log\LogLevel::WARNING => 'status-dialog-warning',
\Psr\Log\LogLevel::ERROR => 'status-dialog-error',
]
$finishtime
Is set via finish() with the millisecond time when the request handler is finished.
protected
float
$finishtime
= 0
$isEnabled
If set to true (see constructor) then then the timetracking is enabled
protected
bool
$isEnabled
= false
Methods
__construct()
TimeTracker constructor.
public
__construct([bool $isEnabled = true ]) : mixed
Parameters
- $isEnabled : bool = true
decStackPointer()
Decreases the stack pointer
public
decStackPointer() : mixed
Tags
finish()
Usually called when the page generation and output is prepared.
public
finish() : void
Tags
getDifferenceToStarttime()
Gets the difference between a given microtime value and the starting time as milliseconds.
public
getDifferenceToStarttime([float $microtime = null ]) : int
Parameters
- $microtime : float = null
-
The microtime value - if not set the current time is used
Return values
int —The difference between a given microtime value and starting time as milliseconds
getMilliseconds()
Gets a microtime value as milliseconds value.
public
getMilliseconds([float $microtime = null ]) : int
Parameters
- $microtime : float = null
-
The microtime value - if not set the current time is used
Return values
int —The microtime value as milliseconds value
getParseTime()
Get total parse time in milliseconds
public
getParseTime() : int
Return values
intincStackPointer()
Increases the stack pointer
public
incStackPointer() : mixed
Tags
printTSlog()
Print TypoScript parsing log
public
printTSlog() : string
Return values
string —HTML table with the information about parsing times.
pull()
Pulls an element from the TypoScript tracking array
public
pull([string $content = '' ]) : mixed
Parameters
- $content : string = ''
-
The content string generated within the push/pull part.
Tags
push()
Pushes an element to the TypoScript tracking array
public
push(string $tslabel[, string $value = '' ]) : mixed
Parameters
- $tslabel : string
-
Label string for the entry, eg. TypoScript property name
- $value : string = ''
-
Additional value(?)
Tags
setEnabled()
public
setEnabled([bool $isEnabled = true ]) : mixed
Parameters
- $isEnabled : bool = true
setTSlogMessage()
Logs the TypoScript entry
public
setTSlogMessage(string $content[, string|int $logLevel = LogLevel::INFO ]) : mixed
Parameters
- $content : string
-
The message string
- $logLevel : string|int = LogLevel::INFO
-
Message type: 0: information, 1: message, 2: warning, 3: error or the LogLevel constants - will become the LogLevel constants only in TYPO3 v12.0.
Tags
setTSselectQuery()
Set TSselectQuery - for messages in TypoScript debugger.
public
setTSselectQuery(array<string|int, mixed> $data[, string $msg = '' ]) : mixed
Parameters
- $data : array<string|int, mixed>
-
Query array
- $msg : string = ''
-
Message/Label to attach
start()
Sets the starting time
public
start([float|null $starttime = null ]) : mixed
Parameters
- $starttime : float|null = null
Tags
createHierarchyArray()
Helper function for internal data manipulation
protected
createHierarchyArray(array<string|int, mixed> &$arr, int $pointer, string $uniqueId) : mixed
Parameters
- $arr : array<string|int, mixed>
-
Array (passed by reference) and modified
- $pointer : int
-
Pointer value
- $uniqueId : string
-
Unique ID string
Tags
fixCLen()
Wraps the input content string in green colored span-tags IF the length of the input string exceeds $this->printConf['contentLength'] (or $this->printConf['contentLength_FILE'] if $v == "FILE"
protected
fixCLen(string $c, string $v) : string
Parameters
- $c : string
-
The content string
- $v : string
-
Command: If "FILE" then $this->printConf['contentLength_FILE'] is used for content length comparison, otherwise $this->printConf['contentLength']
Return values
stringfixContent()
Recursively generates the content to display
protected
fixContent(array<string|int, mixed> &$arr, string $content[, string $depthData = '' ][, string $vKey = '' ]) : string
Parameters
- $arr : array<string|int, mixed>
-
Array which is modified with content. Reference
- $content : string
-
Current content string for the level
- $depthData : string = ''
-
Prefixed icons for new PM icons
- $vKey : string = ''
-
Seems to be the previous tsStackLog key
Return values
string —Returns the $content string generated/modified. Also the $arr array is modified!
fw()
Wraps input string in a <span> tag
protected
fw(string $str) : string
Parameters
- $str : string
-
The string to be wrapped