Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting of peak rss memory on Linux #383

Closed
giampaolo opened this issue May 23, 2014 · 2 comments
Closed

Getting of peak rss memory on Linux #383

giampaolo opened this issue May 23, 2014 · 2 comments

Comments

@giampaolo
Copy link
Owner

From grds...@gmail.com on May 21, 2013 14:28:45

Now get_ext_memory_info() on Windows returns peak working set but doesn't 
return peak rss on Linux.

It is possible to get peak rss on Linux reading VmHWM field from 
/proc/pid/status.

Original issue: http://code.google.com/p/psutil/issues/detail?id=383

@tijko
Copy link
Contributor

tijko commented Jul 21, 2016

On Linux systems this could be exposed under /proc/$PID/status in the VmHWM entry. Just as simply as, adding an extra field under pmem tuple and using a re.compile with _read_status_file.

@NotSqrt
Copy link

NotSqrt commented Aug 6, 2018

Or a separate method, something like this, in _pslinux:

    @wrap_exceptions
    def peak_rss(self, _hwm_re=re.compile(br'VmHWM:\s+(\d+)\s+kB')):
        # Returns Peak resident set size in bytes
        data = self._read_status_file()
        val, = _hwm_re.findall(data)[0]
        return int(val) * 1024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants