1. 当前位置:网站首页 > 常用命令

记录一次linux下程序性能分析方法


基于系统运行情况优化

多进程下判断进程的消耗情况

首先根据程序中通过进程名进行区分,通过setproctitle库设置进程对应的名称

server = socketserver.ThreadingUDPServer(('0.0.0.0', 21800), MyHandler)
setproctitle.setproctitle('python3- 雷达基础接收服务')
for i in mac_list:
    deal = Process(target=deal_data, args=(mac_list[i][1],))
    deal.daemon = True
    deal.start()
    setproctitle.setproctitle('python3- 雷达处理服务--%s' % i)
    server.serve_forever()

通过命令查看服务 ps -ef | grep python3

[root@localhost ~]# ps -ef | grep python3
root       5071      1  1 10月09 ?      00:18:54 python3 server2.py
root       5072   5071  3 10月09 ?      00:51:33 python3 server2.py
root       5073   5071  3 10月09 ?      00:47:38 python3 server2.py
root       5074   5071  3 10月09 ?      00:47:33 python3 server2.py
root       5075   5071  3 10月09 ?      00:47:36 python3 server2.py
root       5076   5071  3 10月09 ?      00:47:44 python3 server2.py
root      74806      1  0 10月09 ?      00:00:35 python3 api.py
root     157028 126644 29 13:47 pts/4    00:00:00 python3- ?达处理服务--32:06:02:44:00:4b
root     157030 157028 10 13:47 pts/4    00:00:00 python3- ?达基础接收服务
root     157469  48112  0 13:47 pts/5    00:00:00 grep --color=auto python3

python3 -m memray run --live server.py 实时分析内存情况


本文最后更新于2023-10-10,已超过 3个月没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!
版权说明

本文地址:http://www.liuyangdeboke.cn/?post=54
未标注转载均为本站远程,转载请注明文章出处:

发表评论


评论列表

**
** 2023-10-11 09:49回复
#1
感谢分享

联系我们

在线咨询:点击这里给我发消息

微信号:17721538135

工作日:9:00-23:00,节假日休息

扫码关注