! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
genmon moderate CPU use (excluding my scripts)


Description Tcll5850 2019-04-25 14:48:25 CEST
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.
Comment 1 Git Bot editbugs 2020-05-23 00:01:41 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/panel-plugins/xfce4-genmon-plugin/-/issues/5.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #15328

Reported by:
Reported on: 2019-04-25
Last modified on: 2020-05-23


Xfce-Goodies Maintainers
CC List:
0 users




Additional information