Unaccountable CPU Usage

Posted:
in Genius Bar edited January 2014
I noticed that my PowerBook (1.5 GHz 12") has been running warm today, so I checked in Activity Monitor, and noticed something odd... Although the individual process list showed fairly constant CPU usage (around 10% over three or four processes), but the scrolling chart would occasionally peak, showing a CPU usage of around 30%, but the individual process list didn't reflect this increase. The increase happens roughly every two minutes, and lasts for about 30 seconds.



Any ideas?

Comments

  • Reply 1 of 14
    dobbydobby Posts: 797member
    Are you running tiger? It could be spotlight.

    Do you have any network connections?

    Are you connected to the internet and its updating some web ad?

    Does it do this after a reboot?



    Dobby.
  • Reply 2 of 14
    digitaldavedigitaldave Posts: 445member
    Quote:

    Originally posted by dobby

    Are you running tiger? It could be spotlight.

    Do you have any network connections?

    Are you connected to the internet and its updating some web ad?

    Does it do this after a reboot?



    Dobby.




    I am running Tiger. I'm not sure if it's Spotlight - one thing I have just noticed is that there are two instances of 'mdimport', one under my username, one under the username 'nobody' - this is the only process under that user name.



    AFAIK, there are no network connections going, and there are no apparent network activity during the CPU increases.



    Safari wasn't running most of the time, so I guess I wasn't connected to the internet.



    It does it after reboot, and also after repairing permissions.



    The thing that confuses me is that the process listing doesn't show any tasks taking up the total amount of CPU time, yet the stats below it show CPU activity around 25-30%.
  • Reply 3 of 14
    dobbydobby Posts: 797member
    You could open terminal windows (under /apps../utils..)

    and do a

    $ top -o cpu (leave out the $)

    this will show all processes running, cort by cpu and will tell you which one is using what percentage of cpu time.

    Not 100% accurate but good enough.





    Dobby.
  • Reply 4 of 14
    digitaldavedigitaldave Posts: 445member
    dobby,



    I gave that a try, but similar results as before, i.e., if you add up the CPU time of all the processes running during the activity spikes it comes to much less than the cpu in use % shown in both Activity Monitor and top.



    I did some more research, and I've noticed that the process SystemUIServer (which is running under my user name) normally runs at 0.00% cpu use, but spikes up to 0.10% for a second just before the increase in CPU use by the system, then returns to 0.00%, and repeats this just before the end of the bump. I haven't noticed a similar spike in root user tasks, despit the fact that it is a spike in system CPU use, not user CPU use.



    UPDATE:

    It looks like the 'update' process (owned by root) does a similar thing just before and just after the CPU load bump, but this one spikes to about 0.90%.



    I'm beginning to think that 'it's just one of those things' intorduced by Tiger \.
  • Reply 5 of 14
    dferranddferrand Posts: 4member
    This happened to me, Menu Meters showed that I was running my CPU at about 90% all the time. I finally figured out it was Virex. I had to download the Virex installer from .Mac, and then run the uninstaller. The problem ended immediately
  • Reply 6 of 14
    digitaldavedigitaldave Posts: 445member
    I should have said, it's not a Virex issue, as I've never had Virex on my system.
  • Reply 7 of 14
    digitaldavedigitaldave Posts: 445member
    A clean install hasn't done the trick either \. Any other ideas?



    EDIT: zapped the PRAM, didn't make any difference .
  • Reply 8 of 14
    dobbydobby Posts: 797member
    In the activity monitor the cpu figure is updated every sec yet the proc window updates every 2 secs on normal update mode. Activity monitor requires more CPU than most processes.



    How does top report the discrepancy?

    Is the idle time different from the total % of used time by the individual procs?

    If this really is the case then use things like vmstat, iostat and netstat to see if its disk, net or mem activity.



    Dobby.
  • Reply 9 of 14
    digitaldavedigitaldave Posts: 445member
    Quote:

    Originally posted by dobby

    In the activity monitor the cpu figure is updated every sec yet the proc window updates every 2 secs on normal update mode. Activity monitor requires more CPU than most processes.



    How does top report the discrepancy?

    Is the idle time different from the total % of used time by the individual procs?

    If this really is the case then use things like vmstat, iostat and netstat to see if its disk, net or mem activity.



    Dobby.




    top reports a similar thing when the load goes up. There's something going on that isn't accounted for in the process listing.



    So what are vmstat, iostat and netstat, how do I use them, and what am I looking for? .
  • Reply 10 of 14
    dobbydobby Posts: 797member
    open terminal

    $ man netstat

    show network stats

    $ man iostat

    shows disk io stats

    $ man vm_stat

    show virtual mem stats.



    open a couple of terminal windows and run

    $ top -o cpu -s 1 (sort by cpu interval of 1 sec)

    $ netstat -i 1 (interval of 1 sec)

    are high number of packets or collisions occuring at the peaks

    $ iostat 1 (interval of 1 sec)

    is the disk showing high throughput while the cpu usage is high

    $ vm_stat 1 (interval of 1 sec) this is the tricky one.

    Are the pageouts increasing quickly and in chunks.

    If so then your system is swapping. This is very page.

    Install more memory.

    A pageout occurs when a page (chunk) of physical memory (on the chips) is paged (swapped or written) to the swapfile pon the hard drive. A page is either 2 or 4K.



    Dobby.
  • Reply 11 of 14
    digitaldavedigitaldave Posts: 445member
    Quote:

    Originally posted by dobby

    open terminal

    $ man netstat

    show network stats

    $ man iostat

    shows disk io stats

    $ man vm_stat

    show virtual mem stats.



    open a couple of terminal windows and run

    $ top -o cpu -s 1 (sort by cpu interval of 1 sec)

    $ netstat -i 1 (interval of 1 sec)

    are high number of packets or collisions occuring at the peaks

    $ iostat 1 (interval of 1 sec)

    is the disk showing high throughput while the cpu usage is high

    $ vm_stat 1 (interval of 1 sec) this is the tricky one.

    Are the pageouts increasing quickly and in chunks.

    If so then your system is swapping. This is very page.

    Install more memory.

    A pageout occurs when a page (chunk) of physical memory (on the chips) is paged (swapped or written) to the swapfile pon the hard drive. A page is either 2 or 4K.



    Dobby.




    Thanks .



    netstat: nothing to report

    iostat: nothing to report



    vm_stat:



    Faults: fairly constant at around 360, occasional variation.

    Copy: 0

    zerofill: fairly constant at around 220, occasional variation

    Reactive: 0

    Pageins: 0

    Pageout: 0



    Installed memory is fixed 256MB + 512MB in the user slot. Woudl it be worth taking this out and seeing what happens? I know this would only leave 256MB available, but there wouldn't be anything other than top and vm_stat running.
  • Reply 12 of 14
    dobbydobby Posts: 797member
    Don't worry about pagefaults they happen all the time.

    I can't see physical memory causing the system to require cpu involvement.

    Physical mem problem generally cause instability and problems during install etc.



    If you have a spare partition or disk it would be interesting to see if a new install caused the same phenonemon (sp?),



    Dobby.
  • Reply 13 of 14
    digitaldavedigitaldave Posts: 445member
    Quote:

    Originally posted by dobby

    Don't worry about pagefaults they happen all the time.

    I can't see physical memory causing the system to require cpu involvement.

    Physical mem problem generally cause instability and problems during install etc.



    If you have a spare partition or disk it would be interesting to see if a new install caused the same phenonemon (sp?),



    Dobby.




    I'm glad to hear that it shouldn't be a problem with physical RAM .



    I only have one partition on my HD .



    Maybe 'its just one of those things' - if it is, hopefully it'll get sorted with 10.4.1. after all, it's not stopping me using my PowerBook, it's just irritating me that it's doing something it shouldn't, and I want it to stop .



    Dave.
  • Reply 14 of 14
    randycat99randycat99 Posts: 1,919member
    I completely agree with you that "leaking" or unaccounted for CPU% is something that should be kept in check by Apple developers. It may seem a small issue to most who are running Ghz-worth of CPU and are on a static workstation tied to a permanent powerline. However, if you are on a laptop, you tend to value each of those CPU% ticks a bit more, not only for the sake of keeping those resources for real stuff you are doing on your computer, but to conserve battery life. If you have some process leeching off 15, 30, 50% (?!) continuously (or even momentarily, but regularly), and nothing obvious sticks out as a means to stop it, that's pretty damn frustrating on a laptop.



    Though I have not an idea what is leeching your CPU, I can relate to your predicament in reference to the way Safari seems to behave. I don't have to be connected to the Internet, it doesn't even have to be in the foreground, and Safari can sometimes get to where it is sucking down 30% of my CPU just to freakin sit there! On a laptop, that is kinda brutal on battery charge. If I'm in class, that could bring the time-to-recharge down from 6/7/8 hrs to 3 hrs. So I am faced with quitting Safari and dumping all the pages I have "on-deck" for my perusal. I got to go reload everything when I get back to a AC plug-in mode. That's a HUGE pisser for me. Put simply, Safari has a real "CPU-leak" issue. It doesn't play nice with the resources, it doesn't even seem to "sleep" if it hasn't been used after a while (IE will intelligently go down to just a mere tenths of a % point if it has been sitting in the background or hidden for a while).



    This lead me to want to make a suggestion in the OSX forum (now defunct?). I think it would be very useful (for laptop users, at least) if you could "sleep" or "hibernate" individual processes (or apps, more likely). Naturally, this sounds like a really odd request all by itself, but it makes A LOT of sense when you get to scenarios such as unruly apps (such as Safari) + battery-operated laptop mode. If I don't want to "flush-out" the state of a particular app by simply "quitting", but I would like to suspend its operation for later revival, then a discrete sleep/hibernate would be really kewl, imo. ...or maybe there could be a "restore state" feature in the app, itself. Before quitting, you could activate a "store app/data state", so when you later restart the app, it is restored to exactly to the state it was right before you quit. Naturally, this isn't of much use if only some apps do it and not the ones that need it. So I lean more heavily to making this feature a universal function that is the OS, itself, makes possible.
Sign In or Register to comment.