[Goodies-dev] [Bug 15328] New: genmon moderate CPU use (excluding my scripts)
bugzilla-daemon at xfce.org
bugzilla-daemon at xfce.org
Thu Apr 25 14:48:25 CEST 2019
https://bugzilla.xfce.org/show_bug.cgi?id=15328
Bug ID: 15328
Summary: genmon moderate CPU use (excluding my scripts)
Classification: Panel Plugins
Product: Xfce4-genmon-plugin
Version: unspecified
Hardware: PC (x86_64)
OS: Linux
Status: NEW
Severity: normal
Priority: Medium
Component: General
Assignee: goodies-dev at xfce.org
Reporter: tcll5850 at gmail.com
Target Milestone: ---
to start off, I'm not gonna say my scripts don't need optimization
(particularly my network script)
but I was able to fit my mem/swap script right in the genmon command entry:
`sh -c "free -m|awk 'FNR==2{printf(\"mem: %d / %d MiB\n\",$3,$2)}'&&free -m|awk
'FNR==2{printf(\"swap: %d / %d MiB\n\",$3,$2)}'"`
I know it's messy, but for some reason there's a character limit, and for some
reason I can't seem to use `|` directly, so `sh -c ""` is required...
doing this uses significantly less CPU than HDD polling, though it's still a
significant amount due to `sh -c ""` and apparent process respawning over
something like Python's `exec()`.
my network script is another story, which seems to be polled from the HDD every
0.25 seconds, though I could be wrong here (assumption from the performance hit
on a 10-line script)...
anyways, having both of these running at 0.25 consumes about 25-30% of my CPU
(it's a cruddy x64 Pentium4 with HT on for stability)
(0.25 because I like to know exactly what's going on, would go 0.125 (or 0.12
as for some reason limited) if I had the hardware ceiling to)
is it possible I could run in a while loop so I could greatly reduce CPU use
from process spawns??
the rest is just the cat and awk commands in my scripts that could probably be
optimized.
I hope you're not trying to enforce disk reads every spawn as that would be
very bad. ;)
at a glance, this plugin seems to be single-threaded as I can't open the
options while in use
it waits for the spawn to finish before showing the R-click menu.
how would I recommend better?
dual-thread the spawn process while re-executing the shell code and remove the
character and command limits (the command should be handled the same as a line
in the terminal).
(it's better to store the process code in memory than to re-read it from the
script file on the HDD)
if I could write this plugin in python, I could probably write something more
efficient.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Goodies-dev
mailing list