Check cpu usage

I noticed that while idle my CPU usage spikes to 20% every few seconds. However, activity monitor shows no process using a lot of CPU during those spikes (I have activity monitor set to show all processes). As there any way in Unix that I can track CPU usage over say 10s and find out which process causes this spike?

Hmm, I wonder if this is not related to a specific process, but rather something like a NIC thread or something similar which doesn't show up obviously in top output.
You could try the "ps" technique, though that might suffer from the same limitation that top does. No harm in trying though. From the command line, do something like:
user% for ((i=0; i<30; i++)); do
for> ps alx >> ps.out
for> echo "\n=====\n" >> ps.out
for> sleep 1
for> done
Then look through your results in the "ps.out" file at the CPU column. Maybe you'll see something in there. That column is the %cpu -- from the ps man page:
   %cpu   The CPU utilization of the process; this is a decaying average over up to a minute
     of previous (real) time. Because the time base over which this is computed varies
     (some processes may be very young), it is possible for the sum of all %cpu fields to
     exceed 100%.

Similar Messages

  • Any Java API to check CPU usage

    Through java code, is it possible to calculate the System CPU usuage.

    Not unless you can find a native library to do it for you. You can check memory, but not CPU availabilty.

  • Cpu usage in java program

    i have writen a java program and run on unix, the program will create a connection object which connects to a db, and create a scoket to communicate with another machine.
    However, when i use the "top" command in unix and check cpu usage, it used about 35% at the begining, and after few seconds, it drops around 7-8%. May I ask if this is normal? any tips on writing java program which can save more system resources?
    please advice. Thanks

    Hello friend ,
    I am Narayanan from PSNA ENGG College, Dindigul , TN ... I try to find CPU Usage in java and get success.... I am also try form same VC++ file... Try this following steps
    if u wont get mail me::: [email protected]
    Bye
    Steps:
    1. Create java file with name CPUUti.java
              class CPUUti {
              public native void displayCPUUsage();
              static {
              System.loadLibrary("hello");
              public static void main(String[] args) {
              new CPUUti().displayCPUUsage();
    2.compile the program
                   javac CPUUti.java
                   Result: Get Class file
    3.Create header file
                   javah CPUUti
                   Result: Header file CPUUti.h is created
    4.Open the VC++ with Design wizard
              choose Win32 Dynamic Link Libarary
              Give Projectname, location
    5.copy the source file and Header files which you want
    Source files:
                   CpuUsage.cpp
                   Main.cpp
                   StdAfx.cpp
    Header Files:
                   CpuUsage.h
                   PerfCounters.h
                   StdAfx.h
    6. include the Header file CPUUti.h in header file
    7. create new C++ source file getCPU.cpp in the same project
    8.include getCPU.cpp file to the Sourcefile list in the same project
    9.copy this code in to getCPU.cpp
                   #include "CpuUsage.h"
                   #include "CPUUti.h"
                   #include "PerfCounters.h"
                   #include "StdAfx.h"
                   JNIEXPORT jint JNICALL Java_CPUUti_Display
                   (JNIEnv * s, jobject s1)
                        CCpuUsage usageA;
                        CCpuUsage usageB;
                        while (true)
                             // Display the system-wide cpu usage and the "Explorer" cpu usage
                             int SystemWideCpuUsage = usageA.GetCpuUsage();
                             int ProcessCpuUsage = usageB.GetCpuUsage("explorer");
                             printf("System-wide Cpu Usage: %3d%%, Explorer cpu usage: %3d%%\r",SystemWideCpuUsage, ProcessCpuUsage);
                             Sleep(1000);
                        return 0;
    10. copy the headerfiles which is present in the jdk\include and jdk\include\win 32
    paste to the VC++\include\
    11.Build the VC++ file.
    12.DLL file is created inside the Debug\ folder
    13.copy that DLL file and paste it to the java source file location
    Run the java file and enjoy...................

  • How to check CPU % Utilization with SNMP

    We are using Ipswitch's What's Up Professional 2006 to monitor devices on our network. Their default snmp graphing utilities use the HOST RESOURCES MIB to collect and graph system performance statistics over time. I have them running perfectly on all my Windows servers, but for my Solaris systems I am only able to retrieve Memory, Disk, and Network Interface statistics. The CPU monitor is unable to retrieve data from our Solaris systems. A typical system is running Solaris 10 with the default agent, NET-SNMP version 5.0.x. Does anyone know if the default agent supports checking CPU usage in the HOST RESOURCES MIB? If not can anyone point me to a different MIB & instance that will return % CPU utilization of a Solaris 10 server? Any input would be greatly appreciated. I've searched everywhere for the solution but I am unable to find any straight-forward answers, hopefully someone can help.

    Hi
      You can do it via  T Code ST02.I am sending you a link hope it help you
    <a href="http://help.sap.com/saphelp_erp2004/helpdata/en/02/96263e538111d1891b0000e8322f96/content.htm">Check this</a>
    Rewards point if helpful
    Thanks
    Pankaj Kumar

  • AIR getting CPU usage

    Does anybody knows how to get CPU Usage from AIR?
    I got it by Native Process listening to a Console Executable that gets info from WMI, but this process consume 25% from my CPU!!!
    Any help will be welcome.

    You can use >sar<
    Usage:
    $sar 2 10
    where 2 means it will check cpu usage every 2 seconds and 10 means it will check the CPU usage 10 times.
    So this query will run for 20 seconds......
    and if you want to see the CPU usage at a particular time by different ORACLE modules like buffer gets, physical reads etc...... then run statspack it will show all the details

  • CPU usage bugs

    When I open 2 type of sites Firefox take unusual CPU
    1.some site like www.tsetmc.com that has some scripts
    2.some site that has flash
    this sites has no problem with other browsers but for FF it gets more CPU even minimized
    I reinstalled FF+ flash and get latest version of them but nothing changed
    finally-for some site I add flash parts to adblock to prevent showing them. but for type 1 sites what can I do?
    Windows 7-64 ultimate
    FF 23

    I tested firefox in safe mode(not windows) and the problem is remained.
    Does anyone see www.tsetmc.com to check CPU usage?

  • Why the OC4J instance CPU Usage still 99% even all user already Logout ?

    Hi All,
    We are running OAS 10.1.3.3 with ADF BC Application.
    At midnight when all user already logout, I notice that :
    - on one instance, CPU keep on 99.9 %
    - on the EM I see that there is there are 5 active sessions and 4 active request.
    How can there are 4 active request while I am sure that I am the only one that login to the EM ?
    I have tried to KILL -3 to create thread dump, but it doesn't work
    How can I know, what are the those 4 active requests ?
    What should I do to find out what consume the CPU ?
    Thank you for your help,
    xtanto
    Edited by: xtanto on Apr 7, 2010 11:23 PM

    Finally...proof that I am not  going mad and that kglad's tweaks to his website make no difference at all to me.
    Flash Player
    Unacceptable CPU Use on Idle
    Created: Tuesday 09:55 PM                   Updated: Yesterday 12:15 PM
    Component/s:
    ActionScript Performance
    Security Level:
    Public (All JIRA Users                                     )
    Severity:
    Performance
    Reproducibility:
    Every Time
    Discoverability:
    High
    Found in Version:
    Flash Player 10              - 10_0_1_218
    Affected OS(s):
    Mac              - OS 10.5
    Injection:
    No
    Steps to Reproduce:
    « Hide
    Steps to reproduce:
    1. Create empty FLA
    2. Publish as AIR or SWF
    3. Install/run AIR app, or run SWF in Stand Alone player or browser
    4. Check CPU usage in Activity Monitor 
      Actual Results:
      CPU usage of 3-6% on idle
      Expected Results:
      CPU usage of ~0% on idle
      Workaround (if any):
      None. Reducing frame rate reduces CPU use, but remains unacceptable even at 1fps.
    This is a very serious issue, particularly for AIR applications. Having 3 or 4 AIR applications open on a Mac (a scenario that Adobe would like to see/promote) would use 10-20% of the CPU minimum, even when the applications are not doing anything. I also suspect that this is the root of at least some of the performance problems with Flash CS4 on Mac, as the stage core / swfPanel players are likely each using a sizable % of CPU even when idle.
    Language Found:
    English
    Bugbase Id:
    none
    Triaged:
    Yes
    Participants:
    Grant Skinner,             Manfred Karrer and             Tao Feng
    Browser:
    Other (specify version)

  • High CPU usage for simple tasks?

    Hello,
    In iTunes, various tasks take 3-4 seconds to happen/start  (rating a song, scrolling up and down within a list of songs, etc.), and I get either rainbow wheel or lag/nothing happening (or both) in the meantime. I did not notice this problem before the new (11) version of iTunes, and no other apps/programs are having issues of any kind. I checked CPU usage while changing the rating of a song and it went to about 55% for 5 seconds or so. That can't be right... it just can't. Is this some kind of bug in iTunes or is there something (simple!) I can do to fix it?
    I'm pretty sure I have Genius turned off, but I've never used it so I really don't even know much about it.
    iMac 24" w/3.06 GHz processor, 4GB memory, the computer's about 4 or 5 years old but still runs very well everywhere else. Currently  running 10.6.8 and my external backup died on me a few months ago, so  updating the OS, if there's ANY chance of losing anything, isn't an option right now.
    I use iTunes a lot so this is driving me insane. Please help!
    Message was edited by: earthimmigrant (clarifying the issue a bit better)

    forgot to mention: OS is solaris 9

  • How to check the usage of ram and cpu Performance for the particular application like sqlserver ,ms word

    how to check the usage of ram and cpu  Performance for the particular application like sqlserver ,ms word
    ranki

    Hi,
    You can use Performance Monitor and add the required counters.
    Check the below Technet article on Performance Monitor.
    http://technet.microsoft.com/en-us/library/cc749249.aspx
    Below are the steps to monitor the process in Performance Monitor.
    - Go to the Performance Monitor. 
    - Right-click on the graph and select "Add Counters".
    - In the "Available counters" list, open the "Process" section by clicking on the down arrow next to it. Select "% Processor Time" (and any other counter you want).
    - In the "Instances of selected object" list, select the process you want to track. Then click on "Add >>" button. Click on OK.
    Regards,
    Jack
    www.jijitechnologies.com

  • How to check the memory and CPU usage on NPU

    Hi expert ,
    Could you tell me how to check the memory and cpu usage on NPU?
    I think ASR1000 has this command (show platform hardware qfp active...) , but I coudn't find the same command on ASR9001.
    I checked " show controllers np counters all"  command, but I did not find it.
    Platform: ASR9001
    version: 4.3.2
    NP: Tyhoon
    Thanks,

    Hi Kanako,
    understand your question, but something like that doesnt exist for the trident/typhoon NPU's for the asr9k.
    in fact cpu usage is not really applicable for parallel/serialized hardware forwarders, but mainly the KPI is here
    the PPS it handles.
    The max pps it can handle is dependent on feature set.
    What you could do is measure the rates on the PARSE_FABRIC_RECEIVE count (packets received from fabric, so egress direction), PARSE_ENET_RECEIVE count (packets received from the interface to the fabric, so ingress) and the LOOPBACK count, that is packets that are recirculated for extra processing. The sum of these 3 gives an idea of the PPS rate the NPU is working on.
    Memory consumption is something tricky also, there are many memories attached to the NPU, notably:
    TCAM used for vlan matching, ACL and QOS matching
    Search memory for L2 and L3 (shared on Trident, separated on Typhoon)
    Frame memory for packet bufferin in QOS
    Stats memory, for all kinds of counters of QOS maps, interface stats etc
    their usage is rather dynamic also.
    The few things you want to verify on these are:
    - ACL usage (in terms of Tcam entries)
    - MAC table size (2M max on typhoon)
    - FIB size (4M max on typhoon)
    frame memory is dependent on the buffering, which is a sum of all the packets instant queue length and size of all pmaps attached to interfaces served by the same NPU. there is no good overview as to how much you have available of that, but it has a rather significant size 1G or 2G depending on the TR or SE cards (typhoon specific).
    regards
    xander
    Xander Thuijs CCIE #6775
    Principal Engineer 
    ASR9000, CRS, NCS6000 & IOS-XR

  • When I am in e-mail. I get the spinning color wheel. Then, when I check the activity montior, it notes high cpu usage (99%) for "Safari web content.". then I quit this process and cpu usage drops way done. but I have to log in again to my e-mail. what can

    When I am in e-mail, I sometimes get the spinning color wheel, which lock up everything. when it doesn't go away, I see on the activity monitor, that CPU usage is very high (99%), for a process calles " Safari web content'. When I click on the proccess and quite, the CPUusage goes way down. Problem is that I have to then log back in to e-mail. What can I do to eliminate this proble.  thanks

    How much FREE RAM do you have when this occurs. It's easy to tell, when it beach balls open Activity Monitor (Applications - Utilities - Activity Monitor) click the System Memory tab and note how much FREE RAM is listed. If it's 500MB or less it's time for a RAM upgrade.

  • Which Is the Best App to Show CPU Usage by App?

    ActMonitor by Aeonika ($.99) and System Activity Monitor by Recession Applications LLC ($1.99) are the 2 activity monitors with 5 star ratings.  However, the info available for each in the App Store and their websites failed to show whether either measured each open and background apps CPU usage individually.
    Knowing that info is the only way we'll get to the bottom of iOS 7.1's higher battery usage.
    Does anyone know of a CPU usage monitor that does give us individual app CPU usage?

    Hi Susan,
    Kindly check out Flash pro CC
    For more details: Explore Adobe desktop apps | Adobe Creative Cloud
    Thanks,
    Atul Saini

  • Firefox is eating up between 90% CPU usage to %230 CPU usage, while on a text-only page. I've tried many of the fixits. They didn't work. What can I do?

    I've cleared cookies multiple times
    I've emptied the cache
    I cleared my download history, and a majority of my browsing history
    I've tried having hardware acceleration for both flash and firefox on and off
    I turned off all my apps and plugins and when that did nothing I turned back on the ones I need. I never had a lot of apps to begin with. only a max of 5. I had quite a few plugins, but i disabled all but quicktime, flash, and silverlight. I have those three set on "ask to activate" so none are "always active" anymore.
    I also tried a couple things from the FAQ and forums here about changing a few settings in the "about:config" setup.
    A few of the above things initially worked, but after a day or two it'd be back to sucking up my CPU and memory. I would then try the same thing again, and this second time there would be no improvement.
    The real memory will fluctuate between 200 MB and 1.7 GB, and has done so for quite a while.
    Even after I've left streaming sites, and sites with lots of images, and I'm not downloading anything, the memory and the CPU will still do that. I only have a handful of tabs open at a timeusually, and all of them are mostly text. I'll quit and reopen firefox, which will initially bring the memory and CPU usage down, but it inevitably climbs up quite quickly, regardless of my tab usage. It'll be the same if I'm playing a flash game or scrolling through blogs.
    I never had any of these problems with Firefox 23, and my internet usage habits haven't changed at all. I had some of this slowness a few times with version 24, but nowhere near as bad as this, or as constant. Almost everyday I end up googling for other ways to speed things up. Everything I do never slowed down Firefox on earlier versions.
    I've tried all my usual tasks on Safari which will never climb above 30-40 MB of memory, even on netflix streaming, or flash games, and the CPU will average around 8 and 11%.

    i'm also having major CPU problems w/ FF 29.0.1. when i restart the app it calms down again but after loading tabs it steadily climbs up to 100% after not too long. i have checked out the 2 CPU links/articles above and do all the basic troubleshooting and tips, but with all the FF tools & add-ons isn't there some sort of CPU monitor that has the ability to display which extensions/scripts are hogging the CPU? Activity Monitor on Mac just shows the total used by the app. it's impossible in my case to efficiently disable dozens of add-ons & scripts, restart, and test each one by one b/c it can take several hrs before the CPU starts to spike high again. i have no time for this.
    thanks

  • Macbook Air running extremely slow - kernel_task at 300% cpu usage

    I purchased my Macbook Air roughly 15 months ago and it's performance has constantly been impressive since I purchased it - until roughly a fortnight ago. I came home from work one afternoon and it was running at a snails pace. I had recently upgraded to Yosemite though I'm unsure if this had anything to do with it. I had also recently installed FitBit software to sync to my new FitBit flex.
    It has continued to run in this manner constantly since the problem began. It is ridiculously slow, every single request takes a very long time to respond. Logging in takes forever. When I click on an app to open it, the icon bounces for 30 seconds or more, and it's not a smooth bounce either, it's quite a jagged bounce!
    I'm hoping someone is able to provide some advice, guidance or help. The laptop is no longer covered by the 12 month Manufacturer Warranty, and I did not purchase an Apple Care plan as no Apple product I've owned before has experienced issues like this.
    This whole experience is killing me! I'm suspecting hardware failure and I'm just so sad that this could happen to the laptop I've loved so much since I bought it!
    The problem:
    The kernel_task process is constantly running at 300% or higher cpu usage, with Activity Monitor indicating the processor is being maxed out by a system task. Also, the laptop's fan is constantly running at full capacity - from the moment the laptop turns on, or wakes up.
    What I think the problem might be:
    As a result of many, many Google searches, it appears that this behaviour may be due to the Macbook Air thinking it is overheating - and I will clarify here that it certainly is not. It is cool to touch, always, when this problem occurs. (yet the fan is almost taking off!). As a result of the MacBook Air thinking it's overheating, it not only is running the fan at a very high RPM (confirmed with iStat), but it also is intentionally choking the system with 'simple requests' in attempt to cool the computer down. Apparently this is a built-in feature of OS X. The kernel has priority over user tasks, causing all user tasks to be granted a lower priority, causing the computer to run INCREDIBLY SLOW. Even as I'm typing this, I'm about two sentences ahead of what is showing on the screen!
    Steps I have taken:
    - Read widely across the internet with every possible relevant search term I can think of
    - Downloaded iStat to see if any of the temperatures are too high (they all seemed fine..)
    - Disabled Bluetooth and Wifi. (no change)
    - Reset SMC (multiple times.., no change)
    - Reset PRAM (multiple times.., no change)
    - Drained the battery completely (2 or 3 times, no change)
    - Install Windows 7 on BootCamp in attempt to bypass the issue (CPU usage was 100% constantly in Windows also)
    - Uninstalled FitBit software (no change..)
    - Uninstalled other software I did not need (no change..)
    - Attempt to boot into Safe Mode / Recovery Mode (even in this modes, the same thing is happening)
    - Repaired Disk Permissions
    - Backed up all personal data
    - Used the built-in Internet Recovery mode to format my Macintosh HD and re-install a fresh copy of OS X (Mountain Lion). (no change…)
    - Re-upgrade to Yosemite (no change..)
    I've downloaded EtreCheck and here is the output:
    Problem description:
    OS X is running incredibly slow. kernel_task process is constantly using 300% and upward CPU usage.
    EtreCheck version: 2.1.5 (108)
    Report generated 20 December 2014 3:38:49 PM AEST
    Click the [Support] links for help with non-Apple products.
    Click the [Details] links for more information about that line.
    Click the [Adware] links for help removing adware.
    Hardware Information: ℹ️
      MacBook Air (11-inch, Mid 2013) (Verified)
      MacBook Air - model: MacBookAir6,1
      1 1.3 GHz Intel Core i5 CPU: 2-core
      4 GB RAM
      BANK 0/DIMM0
      2 GB DDR3 1600 MHz ok
      BANK 1/DIMM0
      2 GB DDR3 1600 MHz ok
      Bluetooth: Good - Handoff/Airdrop2 supported
      Wireless:  en0: 802.11 a/b/g/n/ac
    Video Information: ℹ️
      Intel HD Graphics 5000 - VRAM: 1024 MB
      Color LCD 1366 x 768
    System Software: ℹ️
      OS X 10.8.5 (12F45) - Uptime: 1:24:6
    Disk Information: ℹ️
      APPLE SSD SD0128F disk0 : (121.33 GB)
      disk0s1 (disk0s1) <not mounted> : 210 MB
      Macintosh HD (disk0s2) / : 120.47 GB (106.42 GB free)
      Recovery HD (disk0s3) <not mounted>  [Recovery]: 650 MB
    USB Information: ℹ️
      Apple Inc. BRCM20702 Hub
      Apple Inc. Bluetooth USB Host Controller
    Thunderbolt Information: ℹ️
      Apple Inc. thunderbolt_bus
    Gatekeeper: ℹ️
      Mac App Store and identified developers
    User Login Items: ℹ️
      uTorrent Application (/Applications/uTorrent.app)
    Internet Plug-ins: ℹ️
      QuickTime Plugin: Version: 7.7.1
      JavaAppletPlugin: Version: 14.6.0 - SDK 10.8 Check version
    3rd Party Preference Panes: ℹ️
      None
    Time Machine: ℹ️
      Time Machine not configured!
    Top Processes by CPU: ℹ️
          17% WebProcess
          16% storeagent
          15% Safari
          9% WindowServer
          9% repair_packages
    Top Processes by Memory: ℹ️
      404 MB repair_packages
      395 MB WebProcess
      129 MB Safari
      86 MB App Store
      64 MB Finder
    Virtual Memory Information: ℹ️
      1.77 GB Free RAM
      1.76 GB Active RAM
      140 MB Inactive RAM
      623 MB Wired RAM
      425 MB Page-ins
      0 B Page-outs
    Diagnostics Information: ℹ️
      Dec 13, 2014, 09:47:32 PM /Library/Logs/DiagnosticReports/Kernel_2014-12-13-214732_[redacted].panic [Details]
      Dec 13, 2014, 08:31:50 PM /Library/Logs/DiagnosticReports/Kernel_2014-12-13-203150_[redacted].panic [Details]
      Dec 13, 2014, 04:54:18 PM /Library/Logs/DiagnosticReports/Kernel_2014-12-13-165418_[redacted].panic [Details]
      Dec 13, 2014, 07:05:03 AM /Library/Logs/DiagnosticReports/Kernel_2014-12-13-070503_[redacted].panic [Details]
      Dec 20, 2014, 02:15:38 PM Self test - passed

    Hi,
    I have an update so I thought I would share in case any other users are experiencing a similar problem.
    I made an appointment with the Genius Bar at the Apple Store.
    I went in and they ran a thorough diagnostic check on my Macbook Air and determined that the sensors were indeed faulty - several were providing no information "No reading" instead of providing a temperature. Thus, the Air was unaware of the temperature across multiple components.
    Despite the laptop being outside the 12 Month Manufacturer Warranty, the Apple Store determined that it was covered under warranty through Australian Consumer Law - the laptop is now in for a complete repair under warranty at no cost to myself.
    I couldn't be happier.

  • Google Earth Plugin and LabVIEW: High CPU usage when adding placemarks

    Hi,
    I posted this question on stackoverflow earlier this week but feel it might be better suited to the LabVIEW community specifically so I'm reposting here:
    I'm writing an application which uses the Google Earth Plugin to display events on the globe. Each event is a single point kml placemark with an icon which is a 3kb png file. Placemarks are uploaded to the plugin as they are received by the software. I am experiencing increasing CPU usage with the number of placemarks that are added.
    I have tested displaying a new placemark every second and running until the software running the plugin completely froze (graph attached). The GEPlugin (green trace) stopped responding (i.e. the globe did not respond to the mouse) at around 1200 placemarks added and CPU usage was at ~30%. When the software itself (red trace) froze the plugin was using around 50% CPU and ~3700 placemarks had been added). After the freeze, no new placemarks were added which caused the software to respond (but not the plugin) so I could clear all the placemarks. After the placemarks were cleared from the globe, the CPU usage of the plugin returned to around 5% CPU.
    So what I've seen is that GEPlugin CPU usage increases linearly with each kml placemark added. Is this the expected behaviour/ a normal limitation of the plugin? If not is there a more efficient way of adding many placemarks to the globe?
    I am using GEPlugin version 7.1.1.1580 (API version 1.010) and LabVIEW 12.0f3
    Please see the test results attached. Any input greatly appreciated!
    Original stackoverflow post:
    http://stackoverflow.com/questions/20994323/google-earth-plugin-with-labview-high-cpu-usage-when-add...
    Attachments:
    Performance Log 020114_095115.png ‏82 KB

    Hello,
    I have had a look at your graphs and understood what you are trying to do. To me it seems that as the image gets more complex it gets harde to render which wold likely cause increase in CPU usage resulting in the freeze. I would suggest you try running the program on anoher computer to check on the RAM front of things. If this is a limitation of the GE Plugin then unfortunately I can not do much to help, but if you think this is a problem coming from your LabVIEW code then you can post your code here and I can take a look.

Maybe you are looking for