xdebug的输出文件格式(cachegrind.out) - 疯子的紫梦's 学习窝
流程设计软件 Diagram Designer

xdebug的输出文件格式(cachegrind.out)

疯子的紫梦 posted @ 2010年4月22日 21:58 in php , 3453 阅读

 文:http://www.xdebug.org/docs/all_settings#profiler_output_name

xdebug的性能测试输出文件名是可以配置的。
默认是 xdebug.profiler_output_name = cachegrind.out.%p
那个%p是服务器的pid,会输出“cachegrind.out.1408”之类的文件。
可能这样不太方便测试很多文件的网站。另外对于单一入口的文件名都是一样的.
网上看到的中文文章里面都没有关于这个参数的说明。
我从xdebug官网上找来了它的说明翻译成中文了。

 

符号 含义 配置样例 样例文件名
%c 当前工作目录的crc32校验值 trace.%c trace.1258863198.xt
%p 当前服务器进程的pid trace.%p trace.5174.xt
%r 随机数 trace.%r trace.072db0.xt
%s 脚本文件名(注) cachegrind.out.%s cachegrind.out._home_httpd_html_test_xdebug_test_php
%t Unix时间戳(秒) trace.%t trace.1179434742.xt
%u Unix时间戳(微秒) trace.%u trace.1179434749_642382.xt
%H $_SERVER['HTTP_HOST'] trace.%H trace.kossu.xt
%R $_SERVER['REQUEST_URI'] trace.%R trace._test_xdebug_test_php_var=1_var2=2.xt
%S session_id (来自$_COOKIE 如果设置了的话) trace.%S trace.c70c1ec2375af58f74b390bbdd2a679d.xt
%% %字符 trace.%% trace.%.xt
注 此项不适用于trace file的文件名

从上表可以找到一些适合你的参数。

比如,我想针对每个文件生成一个输出文件。

那么我可以用:

xdebug.profiler_output_name = cachegrind.out.%s

多个域名的话,也可以组合使用

xdebug.profiler_output_name = cachegrind.out.%H.%u.%s

=============================================================

使用Xdebug调试和优化PHP程序系列教程之Xdebug配置,根据Xdebug的官方文档来详细解释Xdebug的参数配置。

第一部分:安装
预编译模块
安装预编译模块是很容易的。只需要将它们放到一个目录中,并将下面的内容添加到php.ini中:(不要忘记更改路径和文件名为你自己的值,并确信你使用的是完整路)
zend_extension_ts = “c:/php/modules/php_xdebug.dll”

第二部分:基本特征:
相关参数设置
xdebug.default_enable
类型:布尔型 默认值:On
如果这项设置为On,堆栈跟踪将被默认的显示在错误事件中。你可以通过在代码中使用xdebug_disable()来禁止堆叠跟踪的显示。因为这是xdebug基本功能之一,将这项参数设置为On是比较明智的。

xdebug.max_nesting_level
类型:整型 默认值:100
The value of this setting is the maximum level of nested functions that are allowed before the script will be aborted.
限制无限递归的访问深度。这项参数设置的值是脚本失败前所允许的嵌套程序的最大访问深度。

第三部分:堆栈跟踪:
相关参数设置
xdebug.dump_globals
类型:布尔型 默认值:1
限制是否显示被xdebug.dump.*设置定义的超全局变量的值
例 如,xdebug.dump.SERVER = REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT 将打印 PHP 超全局变量 $_SERVER['REQUEST_METHOD']、$_SERVER['REQUEST_URI'] 和 $_SERVER['HTTP_USER_AGENT']。

xdebug.dump_once
类型:布尔型 默认值:1
限制是否超全局变量的值应该转储在所有出错环境(设置为Off时)或仅仅在开始的地方(设置为On时)

xdebug.dump_undefined
类型:布尔型 默认值:0
如果你想从超全局变量中转储未定义的值,你应该把这个参数设置成On,否则就设置成Off

xdebug.show_exception_trace
类型:整型 默认值:0
当这个参数被设置为1时,即使捕捉到异常,xdebug仍将强制执行异常跟踪当一个异常出现时。

xdebug.show_local_vars
类型:整型 默认值:0
当这个参数被设置为不等于0时,xdebug在错环境中所产生的堆栈转储还将显示所有局部变量,包括尚未初始化的变量在最上面。要注意的是这将产生大量的信息,也因此默认情况下是关闭的。

第四部分:分析PHP脚本
相关参数设置
xdebug.profiler_append
类型:整型 默认值:0
当这个参数被设置为1时,文件将不会被追加当一个新的需求到一个相同的文件时(依靠xdebug.profiler_output_name的设置)。相反的设置的话,文件将被附加成一个新文件。

xdebug.profiler_enable
类型:整型 默认值:0
开放xdebug文件的权限,就是在文件输出目录中创建文件。那些文件可以通过KCacheGrind来阅读来展现你的数据。这个设置不能通过在你的脚本中调用ini_set()来设置。

xdebug.profiler_output_dir
类型:字符串 默认值:/tmp
这个文件是profiler文件输出写入的,确信PHP用户对这个目录有写入的权限。这个设置不能通过在你的脚本中调用ini_set()来设置。

xdebug.profiler_output_name
类型:字符串 默认值:cachegrind.out%p
这个设置决定了转储跟踪写入的文件的名称。

第五部分:远程Debug
相关参数设置
xdebug.remote_autostart
类型:布尔型 默认值:0
一般来说,你需要使用明确的HTTP GET/POST变量来开启远程debug。而当这个参数设置为On,xdebug将经常试图去开启一个远程debug session并试图去连接客户端,即使GET/POST/COOKIE变量不是当前的。

xdebug.remote_enable
类型:布尔型 默认值:0
这个开关控制xdebug是否应该试着去连接一个按照xdebug.remote_host和xdebug.remote_port来设置监听主机和端口的debug客户端。

xdebug.remote_host
类型:字符串 默认值:localhost
选择debug客户端正在运行的主机,你不仅可以使用主机名还可以使用IP地址

xdebug.remote_port
类型:整型 默认值:9000
这个端口是xdebug试着去连接远程主机的。9000是一般客户端和被绑定的debug客户端默认的端口。许多客户端都使用这个端口数字,最好不要去修改这个设置。

注意:所有以上参数修改后,要重启Apache才能生效!

=======================================================
Xdebug的配置

[Zend]
;关闭ZendExtensionManager,它和Xdebug有冲突,只能加载一个。
;zend_extension_ts=E:\XAMPP\php\zendOptimizer\lib\ZendExtensionManager.dll

[XDebug]
;; Only Zend OR (!) XDebug
zend_extension_ts=”E:\XAMPP\php\ext\php_xdebug.dll”
xdebug.profiler_enable=1
xdebug.profiler_output_dir=”E:\XAMPP\tmp”
xdebug.profiler_output_name=cachegrind.out.%p.%s

;回答四个 w 问题
xdebug.default_enable = On
xdebug.show_exception_trace = On
xdebug.show_local_vars = 1
xdebug.max_nesting_level = 50
xdebug.var_display_max_depth = 6
xdebug.dump_once = On
xdebug.dump_globals = On
xdebug.dump_undefined = On
xdebug.dump.REQUEST = *
xdebug.dump.SERVER = REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT
xdebug.dump.GET=*
xdebug.dump.POST=*
;跟踪代码
xdebug.trace_format = 0
xdebug.auto_trace = On
xdebug.trace_output_dir = “E:\XAMPP\tmp”

;每个文件请求会生成一个trace文件,否则会覆盖,你只能看到最后执行的,
xdebug.trace_output_name = trace.%c.%p.%R
xdebug.collect_vars=on
xdebug.collect_params = 4
xdebug.collect_includes = On
xdebug.collect_return = On
xdebug.show_mem_delta = On

Avatar_small
boardmodelpaper.com 说:
2024年1月12日 18:11

A sample or model question paper created by educational boards or other institutions for a variety of exams is commonly referred to as the Board model paper. These practice papers give students a sense of the format, degree of difficulty, and kind of material that may be covered in the real exam, helping them get ready for exams. Typically, model papers are written for particular courses or subjects. They cover boardmodelpaper.com a variety of subjects and chapters that are anticipated to have been studied by students during the course of the semester. These educational board model papers are a common component of test-preparation strategies used by students


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter