The maxrss reported by getrusage is in kilobytes, not pages

pull/270/head
Mark Haines 2015-09-07 16:45:48 +01:00
parent d23bc77e2c
commit 9e4dacd5e7
1 changed files with 3 additions and 4 deletions

View File

@ -17,7 +17,7 @@
from __future__ import absolute_import
import logging
from resource import getrusage, getpagesize, RUSAGE_SELF
from resource import getrusage, RUSAGE_SELF
import functools
import os
import stat
@ -100,7 +100,6 @@ def render_all():
# process resource usage
rusage = None
PAGE_SIZE = getpagesize()
def update_resource_metrics():
@ -113,8 +112,8 @@ resource_metrics = get_metrics_for("process.resource")
resource_metrics.register_callback("utime", lambda: rusage.ru_utime * 1000)
resource_metrics.register_callback("stime", lambda: rusage.ru_stime * 1000)
# pages
resource_metrics.register_callback("maxrss", lambda: rusage.ru_maxrss * PAGE_SIZE)
# kilobytes
resource_metrics.register_callback("maxrss", lambda: rusage.ru_maxrss * 1024)
TYPES = {
stat.S_IFSOCK: "SOCK",