4
require_once("Benchmark/Profiler.php");
7
function __profile__($cmd) {
8
static $log, $last_time, $total;
10
list($usec, $sec) = explode(" ", microtime());
11
$now = (float) $usec + (float) $sec;
15
unregister_tick_function('__profile__');
16
foreach($log as $function => $time) {
17
if($function != '__profile__') {
18
$by_function[$function] = round($time / $total * 100, 2);
24
else if($cmd == 'init') {
28
else if($cmd == 'restart') {
29
register_tick_function('__profile__', $this);
33
$delta = $now - $last_time;
35
$trace = debug_backtrace();
36
$caller = $trace[1]['function'];
37
@$log[$caller] += $delta;
44
function __construct() {
48
function __destruct() {
49
$this->Display(false);
56
register_tick_function('__profile__', $this);
60
$this->profiler = new Benchmark_Profiler(true);
61
$this->profiler->start();
65
function Display($prof = true) {
67
$this->profiler->stop();
68
$this->profiler->display();
71
print_r(__profile__('get'));
76
$this->profiler->start();
77
__profile__('restart');
81
function EnterSection($name) {
82
$this->profiler->enterSection($name);
85
function LeaveSection($name) {
86
$this->profiler->leaveSection($name);
90
//$adei_profiler = new PROFILER();
b'\\ No newline at end of file'