summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2020-11-26 04:32:29 +0100
committerSander Vrijders <sander@ouroboros.rocks>2020-12-02 19:21:25 +0100
commitaef6bdb1eadf8779173145710306ea5b6d81b8ec (patch)
treea5e804050f8103669c8ea77866bf2eb84c31b79b /src
parent632fb36765c2f485b3eb7fec9cdaba24f35e2c15 (diff)
downloadouroboros-aef6bdb1eadf8779173145710306ea5b6d81b8ec.tar.gz
ouroboros-aef6bdb1eadf8779173145710306ea5b6d81b8ec.zip
tools: Default ocbr to sleep and add --spin option
The ocbr client was spinning the CPU by default, which made sense on lab servers with dual xeons, but not so much for average users. Now sleeping becomes the default. Busy waiting can be enabled using --spin if needed. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src')
-rw-r--r--src/tools/ocbr/ocbr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/ocbr/ocbr.c b/src/tools/ocbr/ocbr.c
index e2a23c4a..fe3f1a7d 100644
--- a/src/tools/ocbr/ocbr.c
+++ b/src/tools/ocbr/ocbr.c
@@ -76,6 +76,7 @@ static void usage(void)
" -s, --size packet size (B, max %ld B)\n"
" -r, --rate Rate (b/s)\n"
" --sleep Sleep in between sending packets\n"
+ " --spin Spin CPU between sending packets\n"
"\n\n"
" --help Display this help text and exit\n",
BUF_SIZE);
@@ -87,7 +88,7 @@ int main(int argc, char ** argv)
int size = 1000; /* 1000 byte packets */
long rate = 1000000; /* 1 Mb/s */
bool flood = false;
- bool sleep = false;
+ bool sleep = true;
int ret = 0;
char * rem = NULL;
char * s_apn = NULL;
@@ -138,6 +139,8 @@ int main(int argc, char ** argv)
flood = true;
} else if (strcmp(*argv, "--sleep") == 0) {
sleep = true;
+ } else if (strcmp(*argv, "--spin") == 0) {
+ sleep = false;
} else {
usage();
return 0;