This is an old revision of the document!
Table of Contents
Ubench
Layer: Core · Source: lib/core/Ubench.php:37 (lines 37–207)
class Ubench
Inheritance
No parent, interface or trait. This is a root type.
Constants (0)
None.
Properties (0)
None declared.
Methods (10)
| Visibility | Method | Summary | Line |
|---|---|---|---|
| public | start() | Sets start microtime | 50 |
| public | end() | Sets end microtime | 61 |
| public | getTime() | Returns the elapsed time, readable or not | 80 |
| public | getMemoryUsage() | Returns the memory usage at the end checkpoint | 102 |
| public | getMemoryPeak() | Returns the memory peak, readable or not | 114 |
| public | run() | Wraps a callable with start() and end() calls | 130 |
| public static | readableSize() | Returns a human readable memory size | 150 |
| public static | readableElapsedTime() | Returns a human readable elapsed time | 178 |
| public | hasEnded() | (undocumented) | 198 |
| public | hasStarted() | (undocumented) | 203 |
start()
public function start()
lines 50–53 (4)
Sets start microtime
Takes no parameters.
Returns: (none declared) — void
end()
public function end()
lines 61–70 (10)
Sets end microtime
Takes no parameters.
Returns: (none declared) — $this
Throws: Exception
getTime()
public function getTime($raw = false, $format = null)
lines 80–93 (14)
Returns the elapsed time, readable or not
| Parameter | Type | Default | Description |
|---|---|---|---|
$raw | (untyped) | false | none |
$format | (untyped) | null | The format to display (printf format) |
Returns: (none declared) — float|string
Throws: Exception
getMemoryUsage()
public function getMemoryUsage($raw = false, $format = null)
lines 102–105 (4)
Returns the memory usage at the end checkpoint
| Parameter | Type | Default | Description |
|---|---|---|---|
$raw | (untyped) | false | none |
$format | (untyped) | null | The format to display (printf format) |
Returns: (none declared) — string|float
getMemoryPeak()
public function getMemoryPeak($raw = false, $format = null)
lines 114–119 (6)
Returns the memory peak, readable or not
| Parameter | Type | Default | Description |
|---|---|---|---|
$raw | (untyped) | false | none |
$format | (untyped) | null | The format to display (printf format) |
Returns: (none declared) — string|float
run()
public function run(callable $callable)
lines 130–140 (11)
Wraps a callable with start() and end() calls
Additional arguments passed to this method will be passed to the callable.
| Parameter | Type | Default | Description |
|---|---|---|---|
$callable | callable | required | none |
Returns: (none declared) — mixed
readableSize()
public static function readableSize($size, $format = null, $round = 3)
lines 150–169 (20)
Returns a human readable memory size
| Parameter | Type | Default | Description |
|---|---|---|---|
$size | (untyped) | required | none |
$format | (untyped) | null | The format to display (printf format) |
$round | (untyped) | 3 | none |
Returns: (none declared) — string
readableElapsedTime()
public static function readableElapsedTime($microtime, $format = null, $round = 3)
lines 178–196 (19)
Returns a human readable elapsed time
| Parameter | Type | Default | Description |
|---|---|---|---|
$microtime | (untyped) | required | none |
$format | (untyped) | null | The format to display (printf format) |
$round | (untyped) | 3 | none |
Returns: (none declared) — string
hasEnded()
public function hasEnded()
lines 198–201 (4)
Takes no parameters.
Returns: (none declared)
hasStarted()
public function hasStarted()
lines 203–206 (4)
Takes no parameters.
Returns: (none declared)
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
