f18m/CPU-MEM-monitor

Full command name vs Command

Opened this issue · 3 comments

Is there a reason not to compare against the full command line?

It could allow for more fine-grained control.

So change

  • pgrep -fn vs pgrep -n, and
  • pidstat -l -u -r -t -I -C $THREADNAME vs pidstat -u -r -t -I -C $THREADNAME
f18m commented

I tried and checked pidstat command but it does not seem to work:

root@LMC:~# ps aux | grep nofork
message+   634  0.5  0.2   4748  2336 ?        Ss   Mar12 334:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root     12305  0.0  0.1   3680  1552 pts/0    S+   19:46   0:00 grep nofork
root@LMC:~# pidstat -l -u -r -t -I -C nofork
Linux 4.14.18-sunxi (LMC)       04/27/2018      _armv7l_        (2 CPU)

07:47:05 PM   UID      TGID       TID    %usr %system  %guest    %CPU   CPU  Command

07:47:05 PM   UID      TGID       TID  minflt/s  majflt/s     VSZ    RSS   %MEM  Command

Well ... THREADNAME in the command still needs to be $(basename) (or not at all?).
You then need to filter against the full command line (i.e. in grep)

I tried a quick draft patch, but I was getting "unset" / crashing complaints

f18m commented

Right I see. Unfortunately I don't have much time to help on this... but if you can provide a patch to implement this behavior, it would be welcome!

Regarding "unset" complaints I would like to add a "set -u" at the begin on the bash script to spot typo mistakes and similars... that may help also your development...