#include "pretty-print.h"
#include "sort-util.h"
#include "string-util.h"
+#include "strxcpyx.h"
#include "terminal-util.h"
#include "time-util.h"
#include "utf8.h"
case TABLE_SIZE:
case TABLE_INT64:
case TABLE_UINT64:
+ case TABLE_BPS:
return sizeof(uint64_t);
case TABLE_INT32:
break;
case TABLE_SIZE:
+ case TABLE_BPS:
buffer.size = va_arg(ap, uint64_t);
data = &buffer.size;
break;
return CMP(a->timespan, b->timespan);
case TABLE_SIZE:
+ case TABLE_BPS:
return CMP(a->size, b->size);
case TABLE_INT:
break;
}
+ case TABLE_BPS: {
+ _cleanup_free_ char *p;
+ size_t n;
+
+ p = new(char, FORMAT_BYTES_MAX+2);
+ if (!p)
+ return NULL;
+
+ if (!format_bytes_full(p, FORMAT_BYTES_MAX, d->size, 0))
+ return "n/a";
+
+ n = strlen(p);
+ strscpy(p + n, FORMAT_BYTES_MAX + 2 - n, "bps");
+
+ d->formatted = TAKE_PTR(p);
+ break;
+ }
+
case TABLE_INT: {
_cleanup_free_ char *p;
return json_variant_new_unsigned(ret, d->timespan);
case TABLE_SIZE:
+ case TABLE_BPS:
if (d->size == (size_t) -1)
return json_variant_new_null(ret);