Open 6-6-6 opened 2 years ago
Seems nice, I'll try to check if the memory issue had been resolved.
Seems nice, I'll try to check if the memory issue had been resolved.
After 6 hours, the python process memory was still only around 30MB, memory issue has gone.
Hi, I have just added two more commits.
https://github.com/tlkh/asitop/pull/39/commits/1acead9e3d0216324f5c62b82a04fb5c3a03a31f is to meet the requirement of "Codacy Static Code Analysis".
https://github.com/tlkh/asitop/pull/39/commits/5b6b58c03f4b02523f8e55fd98e5809a6a59093d is to remove the redundant time.sleep(args.interval)
in asitop.asitop.py
,
and the reason is explained in the commit message.
This is an effort to avoid creating temp files under
/tmp
folder.It uses Python's threading and queueing library to receive and preprocess the output of
powermetrics
.The main change is presented in commit 1daf3add70f113a8f1e97f0d410231c7b57f0cec The other 2 commits are for code cleanups.
The whole process is described as follows:
powermetrics
is configured to output tostdout
enqueue_powermetrics()
, which willstdout
into separate plists (by the magicb'\x00'
character)parse_powermetrics()
will get the latest plist from the LIFO queue, and parse the plist as usualThis PR will hopefully resolve issues #18, #17 and #35. Also #6 may also be resolved (without restarting
powermetrics
multiple times).