We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
The community reviewed whether to reopen this question 2 years ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
我找不到任何真正的工具来做到这一点。
但我找到了一组简洁的脚本可以做到这一点。
使用这个小 bash 循环进行日志记录:
这将创建一个名为 /tmp/mem.log 的漂亮的小内存使用日志文件。然后,它使用以下脚本使用 gnuplot 生成数据图像(将其放入
/tmp/show_mem.plt
):然后使用默认的 GNOME 图像查看器打开图像,当它打开时,它会不断重新加载图像变化。因此,如果上述所有循环都是后台的,那么您似乎在图像查看器中运行了一个令人惊叹的内存使用情况图形工具:)
我现在正在跟踪的进程如下所示:
看来我确实有一些内存问题:(
其中大部分内容是从 http://brunogirin.blogspot.com.au/2010/09/memory-usage-graphs-with-ps-and-gnuplot.html,应得的信用。
I couldn't find any real tools to do it.
But I have found a neat small set of scripts that'll do it.
Using this little bash loop to do the logging:
This will create a nice little log file of memory usage called /tmp/mem.log. Then it generates an image of the data with gnuplot using the following script (put this in
/tmp/show_mem.plt
):Then opening the image with the default GNOME image viewer it keeps reloading the image when it changes. So if all the above loop is backgrounded it will appear that you have an amazing memory usage graphing tool running within an image viewer :)
The process I'm tracking right now looks like this:
It looks like I do have some memory issues :(
Much of this was ripped from http://brunogirin.blogspot.com.au/2010/09/memory-usage-graphs-with-ps-and-gnuplot.html, credit where it is due.
接受的答案对我有用,但我有点厌倦了每次想要测量内存时都进行大量复制/粘贴,因此我为此创建了一个小工具: com/parikls/mem_usage_ui" rel="noreferrer">https://github.com/parikls/mem_usage_ui
使用安装
在 shell 中键入
mem_usage_ui
启动浏览器 GUI。结果如下:
The accepted answer worked for me, but I was a bit tired of doing so much copy/pasting every time I want to measure memory, so I've created a small tool for this: https://github.com/parikls/mem_usage_ui
Install using
Start the browser GUI by typing
mem_usage_ui
in the shell.This is what the result will look like:
目标的驻留集大小,
$PID
,进程可以流式传输到ttyplot用于实时显示:上面的
ttyplot -u Mi
可以替换为feedgnuplot --stream --line --point --xlen 20
以获得更多或 GUI 中的相同绘图(gnuplot
,例如,具有图像导出功能)。 feedgnuplot 应该是 可使用apt-get
安装。Resident set size of the target,
$PID
, process can be streamed to ttyplot for live display:ttyplot -u Mi
above can be replaced withfeedgnuplot --stream --line --point --xlen 20
to get more or less the same plot in GUI (ofgnuplot
, which, for instance, has image export). feedgnuplot should be installable withapt-get
.Python 包 Memory Profiler 也适用于非 Python 可执行二进制文件。
使用
mprof
生成可执行文件的完整内存使用情况报告并绘制它:绘图将如下所示:
它在 PyPI 上可用,因此可以安装:
Python package Memory Profiler works with non-Python executable binaries too.
Use
mprof
to generate a full memory usage report of your executable and to plot it:The plot would be something like this:
It is available on PyPI, so it can be installed:
我真的很喜欢使用“htop”而不是“top”。它非常丰富多彩,有很多选项,如设置、搜索、反转、树、排序、漂亮、删除。尝试一下:
I really like using "htop" instead of "top". It's very colorful and has a lot of options like setup, search, invert, tree, sort by, nice, kill. Give it a try:
顶部就能解决问题
Top will do the trick
尝试在命令行中运行命令“top”。这将显示类似于 Windows 任务管理器的进程列表。
Try running the command "top" in the command line. This will display a list of processes similar to the windows task manager.