From cb80d2072257ba45c248833d7555e1b77c846aae Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Wed, 18 Jan 2017 12:19:19 +0200 Subject: bp-sim: add duration argument Change-Id: Ic8ded1dbf03ccfa7891a66e991611b4359da41d0 Signed-off-by: Yaroslav Brustinov --- src/main.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 15bd99dd..dc9e89f4 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,7 +38,7 @@ using namespace std; enum { OPT_HELP, OPT_CFG, OPT_NODE_DUMP, OP_STATS, OPT_FILE_OUT, OPT_UT, OPT_PCAP, OPT_IPV6, OPT_CLIENT_CFG_FILE, OPT_SL, OPT_DP_CORE_COUNT, OPT_DP_CORE_INDEX, OPT_LIMIT, - OPT_DRY_RUN}; + OPT_DRY_RUN, OPT_DURATION}; @@ -69,8 +69,10 @@ static CSimpleOpt::SOption parser_options[] = { OP_STATS, "-s", SO_NONE }, { OPT_CFG, "-f", SO_REQ_SEP }, { OPT_CLIENT_CFG_FILE, "--client_cfg", SO_REQ_SEP }, + { OPT_CLIENT_CFG_FILE, "--client-cfg", SO_REQ_SEP }, { OPT_FILE_OUT , "-o", SO_REQ_SEP }, { OPT_NODE_DUMP , "-v", SO_REQ_SEP }, + { OPT_DURATION, "-d", SO_REQ_SEP }, { OPT_PCAP, "--pcap", SO_NONE }, { OPT_IPV6, "--ipv6", SO_NONE }, { OPT_SL, "--sl", SO_NONE }, @@ -95,7 +97,8 @@ static int usage(){ printf(" Usage: bp_sim [OPTION] -f cfg.yaml -o outfile.erf \n"); printf(" \n"); printf(" \n"); - printf(" options \n"); + printf(" options:\n"); + printf(" -d [s] duration time of simulated traffic in seconds\n"); printf(" -v [1-3] verbose mode \n"); printf(" 1 show only stats \n"); printf(" 2 run preview do not write to file \n"); @@ -194,12 +197,16 @@ static int parse_options(int argc, params["limit"] = atoi(args.OptionArg()); break; + case OPT_DURATION: + sscanf(args.OptionArg(),"%f", &po->m_duration); + break; + case OPT_DRY_RUN: params["dry"] = 1; break; default: - usage(); + printf("Error: option %s is defined, but not handled.\n\n", args.OptionText()); return -1; break; } // End of switch -- cgit 1.2.3-korg