1 From 3ea7303181e80e188e72a4fcd98b9970fe554b3b Mon Sep 17 00:00:00 2001
2 From: Chris Kühl <chrisk@openismus.com>
3 Date: Sat, 16 Apr 2011 23:07:20 +0000
4 Subject: Added SI prefix tera to network counter
6 https://bugzilla.gnome.org/show_bug.cgi?id=639212
8 diff --git a/src/util.cpp b/src/util.cpp
9 index 90073fe..234e6fc 100644
12 @@ -149,10 +149,12 @@ procman_make_label_for_mmaps_or_ofiles(const char *format,
14 procman::format_size(guint64 size, guint64 max_size, bool want_bits)
26 @@ -160,16 +162,18 @@ procman::format_size(guint64 size, guint64 max_size, bool want_bits)
30 - const Format all_formats[2][3] = {
31 - { { 1UL << 10, N_("%.1f KiB") },
32 - { 1UL << 20, N_("%.1f MiB") },
33 - { 1UL << 30, N_("%.1f GiB") } },
34 - { { 1000, N_("%.1f kbit") },
35 - { 1000000, N_("%.1f Mbit") },
36 - { 1000000000, N_("%.1f Gbit") } }
37 + const Format all_formats[2][4] = {
38 + { { 1UL << 10, N_("%.1f KiB") },
39 + { 1UL << 20, N_("%.1f MiB") },
40 + { 1UL << 30, N_("%.1f GiB") },
41 + { 1UL << 40, N_("%.1f TiB") } },
42 + { { 1000, N_("%.1f kbit") },
43 + { 1000000, N_("%.1f Mbit") },
44 + { 1000000000, N_("%.1f Gbit") },
45 + { 1000000000000, N_("%.1f Tbit") } }
48 - const Format (&formats)[3] = all_formats[want_bits ? 1 : 0];
49 + const Format (&formats)[4] = all_formats[want_bits ? 1 : 0];
53 @@ -194,9 +198,12 @@ procman::format_size(guint64 size, guint64 max_size, bool want_bits)
54 } else if (max_size < formats[G_INDEX].factor) {
55 factor = formats[M_INDEX].factor;
56 format = formats[M_INDEX].string;
58 + } else if (max_size < formats[T_INDEX].factor) {
59 factor = formats[G_INDEX].factor;
60 format = formats[G_INDEX].string;
62 + factor = formats[T_INDEX].factor;
63 + format = formats[T_INDEX].string;
66 return g_strdup_printf(_(format), size / (double)factor);