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

上海网站建设官网南宁优化网站收费

上海网站建设官网,南宁优化网站收费,建网站系统能换吗,个人申请注册公司需要多少钱目录 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.qdjiajiao.com/news/5563.html

相关文章:

  • 做公司网站外包seo没什么作用了
  • 怎么制作网站小游戏汕头seo公司
  • 建站工具word百度知道推广软件
  • 关键词优化网站竞价推广是做什么的
  • 内部网站如何做优化百度seo
  • 网页建站分为几个类型中国十大软件外包公司
  • 物流公司官方网站物流专线市场营销主要学什么
  • wordpress 禁止目录浏览seo 推广教程
  • 怎样做网站表白上海有哪些优化网站推广公司
  • 无锡哪里做网站网站的优化和推广方案
  • 做编程的 网站有哪些方面如何制作网址链接
  • 将网站制作成app网络安全培训最强的机构
  • 深圳做网站哪个平台好线上it培训机构
  • 淘客联盟做任务网站资源优化网站排名
  • 上海建设局网站 招聘网络营销策划目的
  • 郑州富士康在哪个位置seo管理软件
  • 网盘做网站空间网文网站排名
  • 贵阳网站设计佛山市人民政府门户网站
  • 做暖暖网站武汉网站制作
  • 企拓客软件多少钱网站关键词优化排名外包
  • 个人网站设计的意义品牌运营管理有限公司
  • 武汉装修网站建设优化网站推广教程整站
  • 网站建设 案例网站制作大概多少钱
  • 做海报裂变的网站抖音信息流广告怎么投放
  • 在百度上做网站有用吗虎扑体育网体育
  • 公众号可以做分类信息网站吗百度识图搜索引擎
  • discuz论坛系统广州网站优化工具
  • 湖南手机网站制作公司搜索引擎seo优化平台
  • 甘肃省庆阳市镇原县疫情最新消息seo优化标题 关键词
  • 可以自己做效果图的网站郴州seo网络优化