summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2016-09-19 10:08:54 +0100
committerFrediano Ziglio <fziglio@redhat.com>2016-09-19 10:08:54 +0100
commitc8aa170948b2d87ce5dedc2263538fa4eb35a184 (patch)
treee96b373772848156e31214f902db2455ddd31817
parentaab04f83c687871c9da1315a2a459ed1d895017a (diff)
Add speed specification in gigabytes/bits
Although you should not use high speed you can specify speeds like 0.01G. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r--README.md2
-rw-r--r--latency.c4
2 files changed, 6 insertions, 0 deletions
diff --git a/README.md b/README.md
index 284288d..a7c200b 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,8 @@ For bandwidth you can specify:
* **K** (1024 bytes/s)
* **m** (1000000 bytes/s)
* **M** (1048576 bytes/s)
+ * **g** (1000000000 bytes/s)
+ * **G** (1073741824 bytes/s)
Also adding **bit** (ie **Mbit**) to specify bits instead of
bytes.
diff --git a/latency.c b/latency.c
index 5a1e0f5..8a9162a 100644
--- a/latency.c
+++ b/latency.c
@@ -82,10 +82,14 @@ static const unit rate_units[] = {
{ "K", 1024 },
{ "m", 1000000 },
{ "M", 1024 * 1024 },
+ { "g", 1000000000 },
+ { "G", 1024 * 1024 * 1024 },
{ "kbit", 1000. / 8. },
{ "Kbit", 1024. / 8. },
{ "mbit", 1000000. / 8. },
{ "Mbit", 1024. * 1024. / 8. },
+ { "gbit", 1000000000. / 8. },
+ { "Gbit", 1024. * 1024. * 1024./ 8. },
{ "", 1 },
{ NULL, 0 }
};