Slight growth of memory detected
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 领域
- networking
调研方向
首先,使用 get_active_devices 和 get_interfaces_info 重现所提供的内存测试,包括接口名称无效的情况。沿着存储库的 Python 绑定和原生实现跟踪这些入口点,然后在每次调查后重复测量。当重复调用不再显示可测量的内存增长时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Get this script (GPLv2 Copyright (c) 2011 Red Hat):
import ethtool
import subprocess, sys, os
max = int(sys.argv[1])
nic = sys.argv[2]
total = 0
def memory():
""" Get current memory usage in MB """
command = "ps --no-header -o rss -p %s" % os.getpid()
p = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
stdout, stderr = p.communicate()
return int(stdout) / 1024
def measure(fun, arg):
""" Run given function on given arg max times """
global total
print("\n%s on %s" % (fun, arg))
start = None
for i in range(max + 1):
result = fun(arg)
if i % (max / 10) == 0:
current = memory()
# note the memory after the first round warm-up
if start is None:
start = current
print("%s %% ... %s MB" % \
(str(100 * i / max).rjust(3), str(current).rjust(3)))
increase = current - start
print("Memory increase: %s MB" % increase)
total += increase
measure(ethtool.get_active_devices, None)
measure(ethtool.get_interfaces_info, nic)
measure(ethtool.get_interfaces_info, 'bad interface name')
print("\nTotal memory increase: %s MB" % total)
if total > 0:
sys.exit(1)
And run:
$ python3.6 ~/tmp/memory.py 1000000 ens3
<built-in function get_active_devices> on None
0.0 % ... 10.1328125 MB
10.0 % ... 10.13671875 MB
20.0 % ... 10.13671875 MB
30.0 % ... 10.13671875 MB
40.0 % ... 10.13671875 MB
50.0 % ... 10.13671875 MB
60.0 % ... 10.13671875 MB
70.0 % ... 10.13671875 MB
80.0 % ... 10.13671875 MB
90.0 % ... 10.13671875 MB
100.0 % ... 10.13671875 MB
Memory increase: 0.00390625 MB
<built-in function get_interfaces_info> on ens3
0.0 % ... 10.13671875 MB
10.0 % ... 10.13671875 MB
20.0 % ... 10.13671875 MB
30.0 % ... 10.13671875 MB
40.0 % ... 10.13671875 MB
50.0 % ... 10.13671875 MB
60.0 % ... 10.13671875 MB
70.0 % ... 10.13671875 MB
80.0 % ... 10.13671875 MB
90.0 % ... 10.140625 MB
100.0 % ... 10.140625 MB
Memory increase: 0.00390625 MB
<built-in function get_interfaces_info> on bad interface name
0.0 % ... 10.140625 MB
10.0 % ... 10.140625 MB
20.0 % ... 10.140625 MB
30.0 % ... 10.140625 MB
40.0 % ... 10.140625 MB
50.0 % ... 10.140625 MB
60.0 % ... 10.140625 MB
70.0 % ... 10.140625 MB
80.0 % ... 10.140625 MB
90.0 % ... 10.140625 MB
100.0 % ... 10.140625 MB
Memory increase: 0.0 MB
Total memory increase: 0.0078125 MB
- 主要语言
- C
- 星标
- 16
- 派生
- 11
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fedora-python/python-ethtool 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 25/100
fedora-python/python-ethtool#61 · 1 条评论 ·
-
help wanted
难度 4/5 3-5 天 新手友好度 25/100
fedora-python/python-ethtool#40 · 5 条评论 ·
-
enhancement
难度 3/5 1-2 天 新手友好度 35/100
查看 fedora-python/python-ethtool 的全部 Issue
相似的 Issue
-
Status: Waiting triage Type: Bug
难度 2/5 1-3 小时 新手友好度 84/100
nanoframework/Home#1857 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 1/5 1 小时以内 新手友好度 92/100
libsdl-org/SDL#16372 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
corazawaf/coraza-nginx#140 ·
-
难度 2/5 1-3 小时 新手友好度 78/100