12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php namespace System;
- class Benchmark {
-
- public static $marks = array();
-
- public static function start($name)
- {
- static::$marks[$name] = microtime(true);
- }
-
- public static function check($name)
- {
- if (array_key_exists($name, static::$marks))
- {
- return number_format((microtime(true) - static::$marks[$name]) * 1000, 2);
- }
- return 0.0;
- }
-
- public static function memory()
- {
- return number_format(memory_get_usage() / 1024 / 1024, 2);
- }
- }
|