Stat.php
1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
class Q_Debug_Xhprof_Stat
{
private $url = 'http://xhprof.test.com';
private $log_path = '/tmp';
private $log_file = '/qin.xhprof.log';
public function __construct($url = 'http://xhprof.test.com')
{
include_once __DIR__ . "/utils/xhprof_lib.php";
include_once __DIR__ . "/utils/xhprof_runs.php";
$this->url = $url;
}
public function start()
{
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
}
public function end($namespace = 'xhprof_foo')
{
$xhprof_data = xhprof_disable();
$xhprof_runs = new XHProfRuns_Default();
$run_id = $xhprof_runs->save_run($xhprof_data, $namespace);
echo "<br /><a href='" . $this->url . "/index.php?run=" . $run_id . "&source=" . $namespace . "' target='_blank'><font color='red'>-= 查看 =-</font></a>";
}
public function setUrl($url)
{
$this->url = $url;
return $this;
}
public function diff()
{
}
}