diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2016-11-30 10:50:09 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-07 10:36:11 +0000 |
commit | ca06e67a0bb5820b38fda4c8dfee20764c1e59ae (patch) | |
tree | e64bbc511f1f1ef2a42a32a2774aa5061e977b18 /scripts/pybootchartgui/pybootchartgui/samples.py | |
parent | 263d189d066b578debf08b2bd07494a69b70f70d (diff) | |
download | openembedded-core-contrib-ca06e67a0bb5820b38fda4c8dfee20764c1e59ae.tar.gz |
pybootchartgui: simplify drawing of memory usage
The internal representation after parsing now matches exactly
what the drawing code needs, thus speeding up drawing a bit.
However, the main motivation is to store exactly that required
information in a more compact file.
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/samples.py')
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/samples.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/samples.py b/scripts/pybootchartgui/pybootchartgui/samples.py index bedca4165a..9fc309b3ab 100644 --- a/scripts/pybootchartgui/pybootchartgui/samples.py +++ b/scripts/pybootchartgui/pybootchartgui/samples.py @@ -53,6 +53,22 @@ class MemSample: # discard incomplete samples return [v for v in MemSample.used_values if v not in keys] == [] +class DrawMemSample: + """ + Condensed version of a MemSample with exactly the values used by the drawing code. + Initialized either from a valid MemSample or + a tuple/list of buffer/used/cached/swap values. + """ + def __init__(self, mem_sample): + self.time = mem_sample.time + if isinstance(mem_sample, MemSample): + self.buffers = mem_sample.records['MemTotal'] - mem_sample.records['MemFree'] + self.used = mem_sample.records['MemTotal'] - mem_sample.records['MemFree'] - mem_sample.records['Buffers'] + self.cached = mem_sample.records['Cached'] + self.swap = mem_sample.records['SwapTotal'] - mem_sample.records['SwapFree'] + else: + self.buffers, self.used, self.cached, self.swap = mem_sample + class DiskSpaceSample: def __init__(self, time): self.time = time |