Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Also handle IEC binary prefixes for bandwidth.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 7 May 2013 07:40:12 +0000 (09:40 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 7 May 2013 08:19:24 +0000 (10:19 +0200)
src/surf/surfxml_parse.c

index 2cff098..96c995e 100644 (file)
@@ -112,12 +112,20 @@ double surf_parse_get_time(const char *string)
 double surf_parse_get_bandwidth(const char *string)
 {
   const struct unit_scale units[] = {
+    { "TiBps", pow(1024, 4) },
+    { "GiBps", pow(1024, 3) },
+    { "MiBps", pow(1024, 2) },
+    { "KiBps", 1024 },
     { "TBps",  1e12 },
     { "GBps",  1e9 },
     { "MBps",  1e6 },
     { "kBps",  1e3 },
     { "Bps",   1.0 },
     { "",      1.0 },           /* default unit is bytes ber second */
+    { "Tibps", 0.125 * pow(1024, 4) },
+    { "Gibps", 0.125 * pow(1024, 3) },
+    { "Mibps", 0.125 * pow(1024, 2) },
+    { "Kibps", 0.125 * 1024 },
     { "Tbps",  0.125 * 1e12 },
     { "Gbps",  0.125 * 1e9 },
     { "Mbps",  0.125 * 1e6 },