xhprof hang

服务器装上xhprof后 能得到数据 总是无法显示出图 也装了graphviz 后来将数据打出来保存为 test.dot(digraph call_graph {xxx} 的那一坨) ,然后cat test.dot | dot -Tpng > test.png ,发现生成了图片,但是报fontconfig的错误。 改xhprof_lib/utils/callgraph_utils.php 中的管道配置,将错误刷到文件去,然后sexy的图图就出来了。


function xhprof_generate_image_by_dot($dot_script, $type) {
$descriptorspec = array(
// stdin is a pipe that the child will read from
0 => array("pipe", "r"),
// stdout is a pipe that the child will write to
1 => array("pipe", "w"),
// stderr is a pipe that the child will write to
//2 => array("pipe", "w"),
2 => array("file","/home/work/tmp/error-output.txt", "w")
);

//$cmd = " dot -T".$type;
$cmd = " /home/work/graphviz/bin/dot -T".$type;
//$process = proc_open($cmd, $descriptorspec, $pipes, "/tmp", array());
$process = proc_open($cmd, $descriptorspec, $pipes, "/home/work/tmp", array());
if (is_resource($process)) {
fwrite($pipes[0], $dot_script);
fclose($pipes[0]);
$output = stream_get_contents($pipes[1]);
/*
$err = stream_get_contents($pipes[2]);
if (!empty($err)) {
print "failed to execute cmd: \"$cmd\". stderr: `$err'\n";
exit;
}
*/
.......................
.......................
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值