当前位置: 首页 > news >正文

坂田网站建设流程wordpress-

坂田网站建设流程,wordpress-,做网站哪些,wordpress 判断是否页面目录 1. 说明 2. PHP脚本性能监测方案 2.1 安装xdebug 2.2 配置xdebug.ini 2.3 命令行与VS Code中使用 - 命令行 - VS Code 2.4 QCacheGrind 浏览 3. Python脚本性能监测方案 3.1 命令行 4. 工具 5.参考 1. 说明 获取我们的脚本程序运行时的指标,对分析…

目录

1. 说明

2. PHP脚本性能监测方案

2.1 安装xdebug

2.2 配置xdebug.ini 

2.3 命令行与VS Code中使用

- 命令行

- VS Code

2.4 QCacheGrind 浏览

3. Python脚本性能监测方案

3.1 命令行

4. 工具

5.参考


1. 说明

      获取我们的脚本程序运行时的指标,对分析与解决性能瓶颈问题是非常重要的一环,以下介绍在PHP与Python下的实践方案:安装性能监测插件 + 产生监测日志 + 用QCacheGrind工具分析
 

2. PHP脚本性能监测方案

2.1 安装xdebug
# wsl2下的ubuntu20 LTS为例apt install php7.4-xdebug

2.2 配置xdebug.ini 

tips: 路径可通过查php -i|grep xdebug.ini获取

zend_extension=xdebug.so# 指定日志输出路径
xdebug.output_dir = "/xdebug_logs"
xdebug.profiler_append = 0xdebug.mode = profile
xdebug.start_with_request = trigger
xdebug.log_level = 7
2.3 命令行与VS Code中使用
- 命令行
php -dxdebug.mode=profile myscript
- VS Code

切记:vscode运行时连接WSL,选择对应的ubuntu目录,不然你的运行环境将不一致

普通的launch.json

{"name": "Debug current script in console","type": "php","request": "launch","program": "${file}","cwd": "${fileDirname}","runtimeArgs": ["-d xdebug.mode=profile"],"externalConsole": false,"port": 9003
}

以TP6为例的launch.json

{"name": "Run PHP Profile","type": "php","request": "launch","cwd": "${workspaceRoot}","program": "${workspaceRoot}/think","args": ["myaction","0"],"runtimeArgs": ["-d xdebug.mode=profile"],"externalConsole": false,"port": 9003
}

截图: 

2.4 QCacheGrind 浏览

 生成的日志保存在 \\wsl.localhost\Ubuntu-20.04\xdebug_logs

 

3. Python脚本性能监测方案

python内部已经提供了cProfile性能监测模块,我们用它就好,只需要把它出来的文件转换一下

3.1 命令行
# 产生日志到./tmp/profile_output.prof
python -m cProfile -o ./tmp/profile_output.prof ./class_test2.py# 转换格式
python -m pyprof2calltree -i profile_output.prof -o callgrind.cprof

4. 工具

工具说明
QCacheGrind

windows工具,能可视化查看callgrind格式的性能数据

下载:https://sourceforge.net/projects/qcachegrindwin/

PHP
XDebug官网: Xdebug - Debugger and Profiler Tool for PHP
Python
cProfile内置标准模块, 性能分析模块
例子: python -m cProfile -o ./tmp/profile_output.prof ./class_test2.py
pyprof2calltree把cprofile产生的性能日志转换为QCacheGrind格式,
例子: python -m pyprof2calltree -i profile_output.prof -o callgrind.cprof

5.参考

- Xdebug: Documentation » Profiling

- The Python Profilers — Python 3.13.0 documentation

- https://gist.github.com/Susensio/efd9422e14556dff4122434c3603aff3

http://www.yayakq.cn/news/35349/

相关文章:

  • 网站做微信支付宝支付宝html5网站开发设计
  • 石家庄网站快速优化排名我要建立自己的网站
  • 做cpa的博客网站类型网站建设属于营业范围里的哪一项
  • 查看网站是由什么开源做的哈尔滨网站建设排
  • 美容行业手机网站模版中国行业信息网官网
  • 备案的网站可以攻击吗网站开发好学不
  • 网站多快能收录seo百度优选官网
  • 广告网站设计怎么样世界最受欢迎的免费架站平台
  • 商标做网站logo大连百度推广排名优化
  • 成都网站定制开发重庆专业网站推广方案
  • 商丘哪里教做网站的wordpress 企业官网
  • 网站链接数怎么做音乐网站开发需要什么语言工具
  • 建设厅网站官网北京4a广告公司有哪些
  • 怎么查看一个网站是哪家公司做的面试网站开发
  • 现在建设校园网站用什么软件永久免费个人网站申请注册
  • 云南网站备案系统云南旅游网站设计
  • 东莞模板建网站平台大型o2o网站开发时间
  • 鲜花网站建设的项目介绍最新领导班子
  • 好看的美食网站设计德州市市政工程建设总公司网站
  • 珠海模板建站公司我想做个网站
  • 合肥企业网站制作公司一个空间多个php网站
  • 企业网站建立制作管理网站用什么系统好
  • 网站建设验收娄底网站建设的话术
  • 国外网站搭建免费的黄金软件
  • 政工网站建设方案徐州网站营销
  • 房山石家庄网站建设知名网站有哪些
  • 郑州的建设网站有哪些手续费微分销系统哪个好
  • 网站开发分析模板科技创新可以被分成三种类型
  • 潍坊网站建设优化排名江苏建筑工程信息网站
  • 青岛营销网站建设惠州有哪些做网站的公司