diff options
author | SeongJae Park <sj@kernel.org> | 2024-04-14 10:08:58 -0700 |
---|---|---|
committer | SeongJae Park <sj@kernel.org> | 2024-04-14 10:08:58 -0700 |
commit | 460e6ecf0108f5055503537391e438cdeb3403fa (patch) | |
tree | 33d45f99d38fa5dcdce8faecc8bfaf4153737076 | |
parent | 790d7e4adf49ee9c54eb2c8001bab47bf1b7474c (diff) | |
download | damo-460e6ecf0108f5055503537391e438cdeb3403fa.tar.gz |
_damo_records/MemFootprint: Support constructor without parameter
Signed-off-by: SeongJae Park <sj@kernel.org>
-rw-r--r-- | _damo_records.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/_damo_records.py b/_damo_records.py index 1b535c80..b1613d87 100644 --- a/_damo_records.py +++ b/_damo_records.py @@ -528,7 +528,10 @@ class MemFootprint: drs = None dt = None - def __init__(self, pid): + def __init__(self, pid=None): + if pid is None: + return + with open('/proc/%s/statm' % pid, 'r') as f: fields = [int(x) for x in f.read().split()] self.size = fields[0] |