65

I'm not entirely sure what you're asking here. Yes, top shows CPU usage as a percentage of a single CPU by default. That's why you can have percentages that are >100. On a system with 4 cores, you can see up to 400% CPU usage. You can change this behavior by pressing I (that's Shift + i and toggles "Irix mode") while top is running. That will cause it to ...


29

UPDATE: Note that the answer below applies to RHEL 6. In RHEL 7, most cgroups are managed by systemd, and libcgroup is deprecated. Since posting this question I have studied the entire guide that I linked to above, as well as the majority of the cgroups.txt documentation and cpusets.txt. I now know more than I ever expected to learn about cgroups, so I'll ...


28

Apps will only max out the CPU if the app is CPU-bound. An app is CPU-bound if it can quickly get all of its data and what it waits on is the processor to process the data. apt-get, on the other hand, is IO-bound. That means it can process its data rather quickly, but loading the data (from disk or from the network) takes time, during which the processor ...


17

It depends on whether your application is a computational one (like this) or interactive. For a computational application, full utilisation of the CPU(s) is your goal, as that means that the result is ready sooner. Anything that causes that utilisation to go down is an opportunity for improvement (e.g. waiting on I/O). For an interactive application, any ...


14

It looks like libmtp found a device, but it's unable to disconnect it properly and it's checking for it constantly. It happens with certain devices and can be disabled by editing /lib/udev/rules.d/69-libmtp.rules Look for a couple of lines that look like this (at the end of the file): # Autoprobe vendor-specific, communication and PTP devices ENV{...


14

Even on a slow system (Raspberry Pi 2+) I'm getting at most 30% CPU load. The Raspberry Pi 2+ has 4 cores. For some monitoring tools, a 100% usage correspond to all the cores been used at 100%. If only one core in a quad code processor is used, the CPU load is 25 %. The 30% CPU load you mention is roughly one core used at 100% while some processes are ...


12

this is a common problem causing nothing but the battery wasted energy decreasing unplugged operation time significantly. the cause of the problem appears to be very simple: you may have too many tabs opened each having bulky and useless endless loops running java-scripts. those java-scripts are usually not origin of the web site you are working with but ...


11

I'm guessing the problem you want to solve is that you have some process running on your box which sometimes misbehaves, and sits forever pegging a core. The first thing you want to do is to attempt to fix the program that goes crazy. That is by far the best solution. I'm going to assume that isn't possible, or you need a quick kluge to keep your box ...


11

to print 10 processes, that use the most CPU ps -aux --sort -pcpu | head Sorting syntax is [+|-]key[,[+|-]key[,...]]. The "+" is optional since default direction is increasing numerical or lexicographic order. Identical to k. For example: ps jax --sort=uid,-ppid,+pid head - will print the first/top 10 lines of file(s) or standard input (by default)


9

just click on '1' while top is running


8

Use udevadm monitor to find out which driver is pooling the cpu.


7

First of all, most of what comes up in search on the web has been deprecated. For example cgmanager is no longer supported on new systemd versions. Don't follow 99% of what comes up in web serches as far as using cuplimit, nice, cgset or other tools for this job. They either won't work at all as advertised (as in the case of cgroup management tools that ...


6

You probably should be interested by process accounting. See acct(2), acct(5), sa(8)


6

After doing some tests, I got the results as below: echo 0 > /sys/devices/system/cpu/cpu4/online does disable the 4th CPU. "disable the 4th CPU" means that the later processes won't be assigned to the 4th CPU anymore. In other words, the processes located at the 4th CPU before "disable the 4th CPU" won't be moved out from the CPU while disabling the ...


5

I had a similar issue and had this short bash script already done. It is calculating the load average for the last 15 minutes, if you want a different timeframe, it shold be change (to check the load avg for last 5 min, change the awk to print $1). This will tell you the relative usage of the CPUs : #!/bin/bash cores=$(nproc) load=$(awk '{print $3}'< /...


4

Another cause: Installed nvidia driver 396 Restart with blank screen Disabled nvidia in bios System works with Intel, but after several sleep/resume I got this from udevadm monitor (random lines but repeating all the same indefinitely): ... KERNEL[10072.040174] remove /module/nvidia (module) UDEV [10072.062670] add /module/nvidia (module) UDEV [...


4

To debug problems with scheduling or applications performance on Linux, it is a good start to run task under perf stat. It reports statistics about the processor pipeline, its stalled cycles, or memory behaviour. Possible problems: Linux/Scheduler bug Intel HT is not keeping up with your threads Memory is not able to provide enough data for the program ...


4

You can do this by running the command inside GNU time. By default, time shows you the real (wall clock), user (CPU-seconds used in user mode), and sys (CPU-seconds used in kernel mode) data items. However, you can also ask it to measure other things, such as RAM and disk usage: /usr/bin/time -f "File system outputs: %O\nMaximum RSS size: %M\nCPU percentage ...


4

The output you have provided looks different from the standard sar -P ALL or sar -u output. I'm not sure if you hand formatted it, or if you're running it through another tool, but I think there's enough information there to figure this out. Here's the important piece of information, obtained from the man page for sar Note: On SMP machines a processor ...


4

you can have the statistics you want about a process by using this Command: pidstat -u -p <PID> for example pidstat -u -p 2345


4

Besides @Yves answer, you actually are able to use the isolcpus kernel parameter. To disable the 4th CPU/core (CPU 3) with Debian or Ubuntu: In /etc/default/grub add isolcpus=3 to GRUB_CMDLINE_LINUX_DEFAULT GRUB_CMDLINE_LINUX_DEFAULT="quiet splash isolcpus=3" Run sudo update-grub Reboot the server. isolcpus — Isolate CPUs from the kernel scheduler. ...


4

Will it solves my problems? It is unlikely. Back in 2012 Chris Siebenmann observed that the Accounts service, which is a system-wide Desktop Bus server, operated in a hugely inefficient and rather dodgy manner. Some of the problems in its architecture that were highlighted then appear to remain to this day. The ways that it handles various databases, ...


4

I was having the same issue with accounts-daemon taking nearly 100% CPU on a 16.04 Ubuntu. In short, the root cause were serial console agetty-s, continously (i.e. a few times a minute) restarted by systemd. (I acknowledge not exactly answering Sam's main question -i.e. disabling wtmp completely-, but other people in trouble are likely to find this page - ...


4

I'm not nearly well-versed enough with cgroups to give a definitive answer (and I certainly don't have experience with cgroups going back to 2013!) but on a vanilla Ubuntu 16.04 cgroups v1 seems to have it's act together: I devised a small test that forces forking as a different user using a child sudo /bin/bash spun off with & - the -H flag is extra ...


4

You see a high system load because tar spends a lot of time waiting for I/O. You see a low CPU usage because tar uses very little CPU time: it's mostly just copying some bytes when the disk delivers them. Linux includes time waiting for I/O in the load average (unlike many other Unix variants), but not in a process's CPU time. (Source: https://...


4

A higher number in b than in r means the CPUs are often idle, so you are right being confused. The document should have read 'means you have an I/O bottleneck'. Beware that the page says r should never be higher than the number of CPUs, and r=16 on a 12 CPU system is a "serious" problem. This is quite exaggerated. That just means CPUs are fully used and ...


3

You are running a lot of extremely short-lived processes. You aren't going to see them much in the top output. Top measures system activity periodically (often once per second). At each refresh, it goes through the process list and collects statistics for each process. Depending on the luck of the draw of scheduling, there may be either zero or one ls ...


3

Just drop the output of the first iteration. top -bn2 | awk '/^top -/ { p=!p } { if (!p) print }'


3

Issues: When sorting numeric fields you probably want to use the -n option: sort -nrk 2. Otherwise a line with a %CPU value of 5.0 will end up higher than one with a value of 12.0. Depending on your ps implementation you might want to use the --no-headers option to get rid of the grep -v. That prevents you from discarding commands that contains PID. I guess ...


3

As Ole Tange wrote, gpg needs random data from /dev/random, which can slow down quite quickly if there is not enough entropy. A good solution to this problem is haveged. If necessary, it provides new entropy to the kernel (and therefore to /dev/random).


Only top voted, non community-wiki answers of a minimum length are eligible