Linux: overhaul io process fields

- avoid UBSAN conversions
- print N/A on no data (i.e. as unprivileged user)
- fix rate calculation to show bytes (instead of a thousandth)
- print bytes as human number (i.e. 8MB) instead of 8388608
- stabilize sorting by adjusting NAN values to very tiny negative number
This commit is contained in:
Christian Göttsche
2021-01-27 15:11:48 +01:00
committed by BenBE
parent fee744abd2
commit fdaa15bd8d
5 changed files with 70 additions and 47 deletions

View File

@ -253,14 +253,18 @@ static inline bool Process_isChildOf(const Process* this, pid_t pid) {
void Process_setupColumnWidths(void);
/* Takes number in kilo units (base 1024) */
void Process_humanNumber(RichString* str, unsigned long long number, bool coloring);
/* Takes number in bare units (base 1000) */
void Process_colorNumber(RichString* str, unsigned long long number, bool coloring);
/* Takes number in hundredths of a seconds */
void Process_printTime(RichString* str, unsigned long long totalHundredths);
void Process_fillStarttimeBuffer(Process* this);
/* Takes number in bare units (base 1024) */
void Process_outputRate(RichString* str, char* buffer, size_t n, double rate, int coloring);
void Process_printLeftAlignedField(RichString* str, int attr, const char* content, unsigned int width);