Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When using htop command, do red values in the time+ column mean there's something wrong?

Below is my server htop display. The nginx process uses CPU time more then 18 hours, and is shown in red color, but CPU and memory all look OK. Is the value within the normal range?

enter image description here

like image 870
artwl Avatar asked Jan 21 '15 03:01

artwl


People also ask

What does red in htop mean?

CPU color bars Low processes in htop are indicated by an excellent value of greater than 0. Green – shows processes running as regular users in the system. Red – shows kernel threads. Aqua Blue – shows virtualized processes.

What do the different colors mean in htop?

Press h inside htop for quick help. CPU Blue : Low-priority threads Green : Normal priority threads Red : Kernel threads Turquoise : Virtualization threads. Memory Green : Used memory Blue : Buffers Yellow/Orange : Cache.

What does time mean in htop?

TIME+: How much processor time the process has used. COMMAND: The name of the command that started the process.

What do the columns mean in htop?

The first three columns represent the average system load of the last 1, 5, and 15 minute periods. The fourth column shows the number of currently running processes and the total number of processes. The last column displays the last process ID used. Let's start with the last number.


1 Answers

I was curious about this too, so I dug into the source code and found this:

if (hours >= 100) {
   snprintf(buffer, 10, "%7lluh ", hours);
   RichString_append(str, CRT_colors[LARGE_NUMBER], buffer);
} else {
   if (hours) {
      snprintf(buffer, 10, "%2lluh", hours);
      RichString_append(str, CRT_colors[LARGE_NUMBER], buffer);
      snprintf(buffer, 10, "%02d:%02d ", minutes, seconds);
   } else {
      snprintf(buffer, 10, "%2d:%02d.%02d ", minutes, seconds, hundredths);
   }
   RichString_append(str, CRT_colors[DEFAULT_COLOR], buffer);
}

So, it looks like whenever the CPU time exceeds one hour, the hour portion is just highlighted in red (or whatever CRT_colors[LARGE_NUMBER] happens to be.)

Notice that the time format changes as the time goes:

4:33.42 is minutes/seconds/millisconds

18h26:41 is hours/minutes/seconds

101h would be hours > 100

like image 81
James Scriven Avatar answered Sep 28 '22 07:09

James Scriven