summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-01-25 17:31:23 +0100
committerJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-01-25 17:31:23 +0100
commit7e0c000767b601cec18b93e18cdd0c232f050441 (patch)
tree00541fd53e91607a36513b5d03939aac3bdd8eaa
parent08fc487dc99e997ab944bfc7c0e2543a339b3dfb (diff)
downloaddpdk-burst-replay-7e0c000767b601cec18b93e18cdd0c232f050441.zip
dpdk-burst-replay-7e0c000767b601cec18b93e18cdd0c232f050441.tar.gz
dpdk-burst-replay-7e0c000767b601cec18b93e18cdd0c232f050441.tar.xz
Add an "--wait-enter" option, to wait that the user press ENTER to start
sending packets (which was default behavior). Now, by default we do not wait the ENTER to be pressed (should facilitate scripting..).
-rw-r--r--src/dpdk.c13
-rw-r--r--src/main.c9
-rw-r--r--src/main.h1
3 files changed, 20 insertions, 3 deletions
diff --git a/src/dpdk.c b/src/dpdk.c
index 6a9dde1..123eb7d 100644
--- a/src/dpdk.c
+++ b/src/dpdk.c
@@ -448,9 +448,16 @@ int start_tx_threads(const struct cmd_opts* opts,
}
}
- /* wait for ENTER and starts threads */
- puts("Threads are ready to be launched, please press ENTER to start sending packets.");
- for (ret = getchar(); ret != '\n'; ret = getchar()) ;
+ if (opts->wait) {
+ /* wait for ENTER and starts threads */
+ puts("Threads are ready to be launched, please press ENTER to start sending packets.");
+ for (ret = getchar(); ret != '\n'; ret = getchar()) ;
+ } else
+ /*
+ wait 1sec to be sure that threads are spawned and ready to start
+ simultaneously (for stats concerns)
+ */
+ sleep (1);
for (i = 0; i < cpus->nb_needed_cpus; i++) {
ret = sem_post(&sem);
if (ret) {
diff --git a/src/main.c b/src/main.c
index afd5c71..fbaea46 100644
--- a/src/main.c
+++ b/src/main.c
@@ -22,6 +22,8 @@ void usage(void)
"Options:\n"
"--numacore numacore : use cores only if it fits the wanted numa.\n"
"--nbruns X : set the wanted number of replay (1 by default). Set to 0 to infinite mode.\n"
+ "--wait-enter: will wait until you press ENTER to start the replay "
+ " (asked once all the initialization are done)"
/* TODO: */
/* "[--maxbitrate bitrate]|[--normalspeed] : bitrate not to be exceeded (default: no limit) in ko/s.\n" */
/* " specify --normalspeed to replay the trace with the good timings." */
@@ -119,6 +121,13 @@ int parse_options(const int ac, char** av, struct cmd_opts* opts)
i++;
continue;
}
+
+ /* --wait-enter */
+ if (!strcmp(av[i], "--wait-enter")) {
+ opts->wait = 1;
+ continue;
+ }
+
break;
}
if (i + 2 > ac)
diff --git a/src/main.h b/src/main.h
index 634735c..13b730c 100644
--- a/src/main.h
+++ b/src/main.h
@@ -33,6 +33,7 @@ struct cmd_opts {
int numacore;
int nbruns;
unsigned int maxbitrate;
+ int wait;
char* trace;
};