惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
U
Unit 42
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
F
Full Disclosure
月光博客
月光博客
Engineering at Meta
Engineering at Meta
博客园_首页
The Register - Security
The Register - Security
G
Google Developers Blog
The Cloudflare Blog
博客园 - Franky
K
Kaspersky official blog
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
NISL@THU
NISL@THU
AI
AI
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Vercel News
Vercel News
T
Tor Project blog
P
Privacy International News Feed
D
Docker
I
Intezer
L
LangChain Blog
P
Proofpoint News Feed
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
博客园 - 聂微东
AWS News Blog
AWS News Blog
Martin Fowler
Martin Fowler
P
Privacy & Cybersecurity Law Blog
V
V2EX
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
The Hacker News
The Hacker News
T
Tenable Blog
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog

博客园 - 程序猿101

2024年总结。。。。2025年规划。 八皇后问题c语言版(xcode下通过) 对分布式一些理解 观察者模式 用redis实现悲观锁(后端语言以php为例) 只用200行Go代码写一个自己的区块链!(转) 用户中心 - 博客园 php的生命周期的概述 linux网络编程1 最简单的socket编程 mysql 慢查询 2016年终总结。。。六年从创业到技术的历程 Linux下chkconfig命令详解 这个简单明了啊 JS的prototype和__proto__ Constructor vagrant homestead laravel 编程环境搭建 发现一个百度的密码。。。记最近一段时间的php感想 mysql 的简单优化 百度面试题 字符串相似度 算法 similar_text 和页面相似度算法 百度的面试题 合并两个有序的数组 Ecshop :后台添加新功能 菜单及 管理权限 配置
PHP性能优化工具–xhprof安装
程序猿101 · 2016-02-02 · via 博客园 - 程序猿101

PHP性能优化工具–xhprof安装,这里我先贴出大致的步骤:

1.获取xhprof

2.编译前预处理

3.编译安装

4.配置php.ini

5.查看运行结果

那么下面我们开始安装xhprof工具吧:

1.获取xhprof

可以输入网址直接下载,或者wget

#wget http://pecl.php.net/get/xhprof-0.9.4.tgz

#tar zxf xhprof-0.9.4.tgz

2.编译前预处理

在编译xhprof之前,先做一下预处理,生成configure文件;

#cd xhprof-0.9.4

#cd extension

#phpize

phpize 没有这个命令

用来扩展php扩展模块

phpize是属于php-devel的内容,所以只要运行

yum install php-devel就行。

命令:yum install php-devel -y

位置:/usr/bin/phpize

3.编译安装

#./configure –with-php-config=/usr/bin/php-config

#make && make install

安装成功

4.配置php.ini

在php的配置文件后面追加,xhprof扩展,php.ini

[xhprof]

extension=xhprof.so;

xhprof.output_dir=/usr/share/nginx/html/tmp/xhprof

注:如果是64位系统需要将xhprof.so文件拷贝 /lib64的目录下

#cp /usr/lib64/php/modules/xhprof.so /lib64/

5.查看运行结果

将实例拷贝到自己到web目录下,进行实例演示:

#cp -r examples xhprof_html xhprof_lib /usr/share/nginx/html/xhprof

a.运行实例查看效果,在浏览器输入

http://localhost/xhprof/examples/sample.php

result

b.复制上面到运行到结果(http路径),再次放入浏览器,填好前面对应的域名:

http://localhost/xhprof/xhprof_html/index.php?run=5307089e3e0fe&source=xhprof_foos

查看结果,正确:

view

如果输入浏览器没有数据

这种情况:Run #530707980ee18: Invalid Run Id = 530707980ee18

错误结果:error

可能是你的配置权限不足,请给个权限,可以直接777,然后重新运行走后这个步骤看看效果。

到这里xhprof安装就结束了,开始你的性能优化之旅吧,有了这个工具会事半功倍的~~

对于xhprof的名词解释:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

Function Name 函数名

Calls 调用次数

Calls% 调用百分比

Incl. Wall Time (microsec) 调用的包括子函数所有花费时间 以微秒算(一百万分之一秒)

IWall% 调用的包括子函数所有花费时间的百分比

Excl. Wall Time (microsec) 函数执行本身花费的时间,不包括子树执行时间,以微秒算(一百万分之一秒)

EWall% 函数执行本身花费的时间的百分比,不包括子树执行时间

Incl. CPU(microsecs) 调用的包括子函数所有花费的cpu时间。减Incl. Wall Time即为等待cpu的时间

Excl. Wall Time即为等待cpu的时间

ICpu% Incl. CPU(microsecs)的百分比

Excl. CPU(microsec) 函数执行本身花费的cpu时间,不包括子树执行时间,以微秒算(一百万分之一秒)。

ECPU% Excl. CPU(microsec)的百分比

Incl.MemUse(bytes) 包括子函数执行使用的内存。

IMemUse% Incl.MemUse(bytes)的百分比

Excl.MemUse(bytes) 函数执行本身内存,以字节算

EMemUse% Excl.MemUse(bytes)的百分比

Incl.PeakMemUse(bytes) Incl.MemUse的峰值

IPeakMemUse% Incl.PeakMemUse(bytes) 的峰值百分比

Excl.PeakMemUse(bytes) Excl.MemUse的峰值

EPeakMemUse% EMemUse% 峰值百分比

感谢你的阅读,此文http://www.chenglin.name/php/optimization/439.html