Home > Backend Development > PHP Tutorial > PHP 分析工具:forp

PHP 分析工具:forp

WBOY
Release: 2016-06-23 13:35:06
Original
1603 people have browsed it

forp 是简单,非侵入式的,面向产品的 PHP 分析工具。forp 是轻量级的 PHP 扩展,提供 PHP 分析数据。

主要特性:

- 时间测量和每个函数的内存分配
- CPU 使用
- 函数调用的文件和行数
- 使用 Google Trace Event 格式输出
- 函数说明
- 函数分组
- 函数别名 (对匿名函数有用)

简单示例:
<?php// first thing to do, enable forp profilerforp_start(); // here, our PHP code we want to profilefunction foo(){    echo "Hello world !\n";}; foo(); // stop forp bufferingforp_end(); // get the stack as an array$profileStack = forp_dump(); print_r($profileStack);
Copy after login

结果:

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                )         ) )
Copy after login

项目主页:http://www.open-open.com/lib/view/home/1431076898148

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template