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:37:59 +0000 |
commit | 820c042b3603b4ab2a1e439c765085797859efe9 (patch) | |
tree | 04b5a1af836fac64ce0dd3a9232634c5bfe305a6 /scripts/pybootchartgui/pybootchartgui/samples.py | |
parent | 6b5037bf2cbf274ed3e8a7aee3fe9a1b2e039e84 (diff) | |
download | poky-820c042b3603b4ab2a1e439c765085797859efe9.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.
(From OE-Core rev: ca06e67a0bb5820b38fda4c8dfee20764c1e59ae)
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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: | |||
53 | # discard incomplete samples | 53 | # discard incomplete samples |
54 | return [v for v in MemSample.used_values if v not in keys] == [] | 54 | return [v for v in MemSample.used_values if v not in keys] == [] |
55 | 55 | ||
56 | class DrawMemSample: | ||
57 | """ | ||
58 | Condensed version of a MemSample with exactly the values used by the drawing code. | ||
59 | Initialized either from a valid MemSample or | ||
60 | a tuple/list of buffer/used/cached/swap values. | ||
61 | """ | ||
62 | def __init__(self, mem_sample): | ||
63 | self.time = mem_sample.time | ||
64 | if isinstance(mem_sample, MemSample): | ||
65 | self.buffers = mem_sample.records['MemTotal'] - mem_sample.records['MemFree'] | ||
66 | self.used = mem_sample.records['MemTotal'] - mem_sample.records['MemFree'] - mem_sample.records['Buffers'] | ||
67 | self.cached = mem_sample.records['Cached'] | ||
68 | self.swap = mem_sample.records['SwapTotal'] - mem_sample.records['SwapFree'] | ||
69 | else: | ||
70 | self.buffers, self.used, self.cached, self.swap = mem_sample | ||
71 | |||
56 | class DiskSpaceSample: | 72 | class DiskSpaceSample: |
57 | def __init__(self, time): | 73 | def __init__(self, time): |
58 | self.time = time | 74 | self.time = time |