1

So everytime I leave my ubuntu desktop alone, it seems that after a while it starts "working on stuff" -- CPU lights lighting, that busy CPU processing sound being pretty loud, etc. But when I move my mouse, it just goes away.

I don't think it's spyware just yet, but, (puts on tinfoil hat) is there any way to figure out what kind of processes were running that were taking the most CPU time, and log them historically?

I'm thinking of writing a daemon for monitoring this, actually, but if there's already an existing tool for this, that would be better I guess?

kamziro
  • 179

1 Answers1

3

is there any way to figure out what kind of processes were running that were taking the most CPU time, and log them historically?

Set up a cronjob, running every minute and appending date and ps auxk time | tail -N to your chosen log file. Set N to how many CPU hogs you want logged. Default (without -N) is 10. The total time (in minutes) as of a particular timestamp is the second-last column, in descending order, just before the process name:

izx       2096  0.0  0.6 396920  7000 ?        Ssl  16:41   0:11 gnome-session --session=ubuntu
izx       2147  0.0  1.1 681920 11404 ?        Sl   16:41   0:16 /usr/lib/gnome-settings-daemon/gnome-settings-daemon
izx       2275  0.0  0.8 421544  8684 ?        Sl   16:41   0:16 /usr/lib/bamf/bamfdaemon
izx       2311  0.0  2.8 614148 29388 ?        Sl   16:41   0:16 /usr/lib/unity/unity-panel-service
root      1736  0.1  0.2  87632  2576 ?        S    16:41   0:24 /usr/sbin/vmtoolsd
izx       2205  0.1  0.9 446056  9208 ?        Sl   16:41   0:30 /usr/lib/vmware-tools/sbin64/vmtoolsd -n vmusr --blockFd 3
izx       2451  0.3  2.3 551928 24348 ?        Sl   16:41   1:10 gnome-terminal
izx       2163  0.9  6.5 1157128 66616 ?       Sl   16:41   3:39 compiz
root      1058  1.5 15.3 320408 156080 tty7    Ss+  16:41   5:53 /usr/bin/X :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch -background none
izx       2541  2.0 16.1 944464 164536 ?       Sl   16:41   8:03 /usr/lib/firefox/firefox

You may want to look at man ps to clean up the fields you don't need.

ish
  • 141,990