Htop is an excellent interactive system monitor process viewer and process manager. It is a modern and good-looking replacement to traditional and old-fashioned TOP found in every UNIX/LINUX systems.
But I saw this (!) exclamation mark next to uptime and confused what it is at first…
But when I read their code as well as documentations, I found that htop adds an exclamation mark if the uptime is greater than 100 days. Here is code copy that shows us that exclamation mark.
int UptimeMeter_attributes[] = { UPTIME }; static void UptimeMeter_setValues(Meter* this, char* buffer, int len) { double uptime = 0; FILE* fd = fopen(PROCDIR "/uptime", "r"); if (fd) { fscanf(fd, "%64lf", &uptime); fclose(fd); } int totalseconds = (int) ceil(uptime); int seconds = totalseconds % 60; int minutes = (totalseconds/60) % 60; int hours = (totalseconds/3600) % 24; int days = (totalseconds/86400); this->values[0] = days; if (days > this->total) { this->total = days; } char daysbuf[15]; if (days > 100) { sprintf(daysbuf, "%d days(!), ", days); } else if (days > 1) { sprintf(daysbuf, "%d days, ", days); } else if (days == 1) { sprintf(daysbuf, "1 day, "); } else { daysbuf[0] = '\0'; } snprintf(buffer, len, "%s%02d:%02d:%02d", daysbuf, hours, minutes, seconds); } MeterClass UptimeMeter_class = { .super = { .extends = Class(Meter), .delete = Meter_delete }, .setValues = UptimeMeter_setValues, .defaultMode = TEXT_METERMODE, .total = 100.0, .attributes = UptimeMeter_attributes, .name = "Uptime", .uiName = "Uptime", .caption = "Uptime: " };
I hope you get it now why it is showing that exclamation mark there.
Leave a Reply