procps/procps-3.2.7-petabytes.patch
2011-08-24 10:15:33 +00:00

45 lines
1.8 KiB
Diff

Add support for displaying petabyte and exabyte values.
Signed-off-by: Tony Ernst <tee@sgi.com>
---
--- procps-3.2.7/top.c 2011-05-31 10:12:53.000000000 -0500
+++ procps-3.2.7/top.c 2011-05-31 10:33:54.000000000 -0500
@@ -761,16 +761,19 @@
* SK_Kb (1) it's kilobytes
* SK_Mb (2) it's megabytes
* SK_Gb (3) it's gigabytes
- * SK_Tb (4) it's terabytes */
+ * SK_Tb (4) it's terabytes
+ * SK_Pb (5) it's petabytes
+ * SK_Eb (6) it's exabytes */
static const char *scale_num (unsigned long num, const int width, const unsigned type)
{
- /* kilobytes, megabytes, gigabytes, terabytes, duh! */
- static double scale[] = { 1024.0, 1024.0*1024, 1024.0*1024*1024, 1024.0*1024*1024*1024, 0 };
- /* kilo, mega, giga, tera, none */
+ /* kilobytes, megabytes, gigabytes, terabytes, petabytes, exabytes, duh! */
+ static double scale[] = { 1024.0, 1024.0*1024, 1024.0*1024*1024, 1024.0*1024*1024*1024,
+ 1024.0*1024*1024*1024*1024, 1024.0*1024*1024*1024*1024*1024, 0 };
+ /* kilo, mega, giga, tera, peta, exa, none */
#ifdef CASEUP_SCALE
- static char nextup[] = { 'K', 'M', 'G', 'T', 0 };
+ static char nextup[] = { 'K', 'M', 'G', 'T', 'P', 'E', 0 };
#else
- static char nextup[] = { 'k', 'm', 'g', 't', 0 };
+ static char nextup[] = { 'k', 'm', 'g', 't', 'p', 'e', 0 };
#endif
static char buf[TNYBUFSIZ];
double *dp;
--- procps-3.2.7/top.h 2011-05-31 10:38:13.554790767 -0500
+++ procps-3.2.7/top.h 2011-05-31 10:38:43.670693506 -0500
@@ -241,7 +241,7 @@
// The scaling 'type' used with scale_num() -- this is how
// the passed number is interpreted should scaling be necessary
enum scale_num {
- SK_no, SK_Kb, SK_Mb, SK_Gb, SK_Tb
+ SK_no, SK_Kb, SK_Mb, SK_Gb, SK_Tb, SK_Pb, SK_Eb
};
// Flags for each possible field