linuxnginxcpuhtop

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


Solution

  • 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