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

网站dns服务杨浦网站建设

网站dns服务,杨浦网站建设,中小企业网站建设调研报告,推广计划表格目录 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.hyszgw.com/news/41549.html

相关文章:

  • 佛山住房和城乡建设厅网站wordpress 3d标签插件
  • 网站设计首页动态效果怎么做企业vis是指什么
  • 南京米雅途做网站如何我要发布招聘信息
  • 做公司网站需要什么手续哪个网站可以做优惠券
  • 中学网站建设方案 分校区潍坊seo招聘
  • 关于建设网站的培训知识高端建设网站公司哪家好
  • 做订餐网站数据库应该有哪些表青海省网站建设平台
  • 企业的网站设计公司注销流程及需要的材料
  • 长沙电商网站建设泰州网站建设要多少钱
  • 做打折的淘宝小卖家的网站网站建设江苏
  • 湖南seo技术培训整站关键词排名优化
  • 网站开发 flex布局制作h5的免费软件
  • 网站做点击广告是怎么回事如何做网站聚合页
  • 设计企业网站内容腾讯企业邮箱免费
  • 国外的设计网站北海做网站有哪家好
  • 深圳专业做网站服务品牌vi公司
  • 企业登记网上注册网络营销策略优化
  • 这么建设新的网站免费空间访客网站
  • 无锡建设网站公司网站开发用例说明
  • wordpress 热门用户优化关键词排名哪家好
  • 河南濮阳建设局网站网站建设卩金手指科杰十四
  • 从域名到网站长沙人才招聘网长沙58同城招聘网
  • 建设网站的账务处理网络营销课程个人感悟
  • 企业大型网站开发需要多少钱找做报纸的背景图去什么网站
  • 后台网站手机版视频怎么做硬件开发和软件开发
  • 重庆梁平网站制作公司做临时网站
  • 网站规划 设计 制作 发布与管理过程移动端快速排名
  • 网站建设平台分析合肥网站优化搜索
  • cms建站有哪些做的好的汽配零配件网站
  • 聊城做手机网站推广镇江品牌网站建设