forpPHP 分析工具
forp 是簡(jiǎn)單,非侵入式的,面向產(chǎn)品的 PHP 分析工具。forp 是輕量級(jí)的 PHP 擴(kuò)展,提供 PHP 分析數(shù)據(jù)。
主要特性:
- 時(shí)間測(cè)量和每個(gè)函數(shù)的內(nèi)存分配
- CPU 使用
- 函數(shù)調(diào)用的文件和行數(shù)
- 使用 Google Trace Event 格式輸出
- 函數(shù)說(shuō)明
- 函數(shù)分組
- 函數(shù)別名 (對(duì)匿名函數(shù)有用)
簡(jiǎn)單示例:
<?php
// first thing to do, enable forp profiler
forp_start();
// here, our PHP code we want to profile
function foo()
{
echo "Hello world !\n";
};
foo();
// stop forp buffering
forp_end();
// get the stack as an array
$profileStack = forp_dump();
print_r($profileStack);
結(jié)果:
Hello world !
Array
(
[utime] => 0
[stime] => 0
[stack] => Array
(
[0] => Array
(
[file] => /home/anthony/phpsrc/php-5.3.8/ext/forp/forp.php
[function] => {main}
[usec] => 94
[pusec] => 6
[bytes] => 524
[level] => 0
)
[1] => Array
(
[file] => /home/anthony/phpsrc/php-5.3.8/ext/forp/forp.php
[function] => foo
[lineno] => 10
[usec] => 9
[pusec] => 6
[bytes] => 120
[level] => 1
[parent] => 0
)
)
)評(píng)論
圖片
表情
