diff options
author | imarom <imarom@cisco.com> | 2016-08-10 17:45:36 +0300 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2016-08-15 16:03:59 +0300 |
commit | ba7b5dff853a3b11b0cc2e7b29cfc1cd99e606f7 (patch) | |
tree | 25a2d72756217ef5d364a4c9b5a6e5e9a9d165a7 /src/rpc-server/commands | |
parent | ce1de344579505665b88c2d548ca8d2acc135988 (diff) |
core mask - first phase
Diffstat (limited to 'src/rpc-server/commands')
-rw-r--r-- | src/rpc-server/commands/trex_rpc_cmd_general.cpp | 13 | ||||
-rw-r--r-- | src/rpc-server/commands/trex_rpc_cmd_stream.cpp | 13 | ||||
-rw-r--r-- | src/rpc-server/commands/trex_rpc_cmds.h | 2 |
3 files changed, 21 insertions, 7 deletions
diff --git a/src/rpc-server/commands/trex_rpc_cmd_general.cpp b/src/rpc-server/commands/trex_rpc_cmd_general.cpp index 080856c2..21f64e2e 100644 --- a/src/rpc-server/commands/trex_rpc_cmd_general.cpp +++ b/src/rpc-server/commands/trex_rpc_cmd_general.cpp @@ -199,10 +199,18 @@ TrexRpcCmdGetUtilization::_run(const Json::Value ¶ms, Json::Value &result) { } for (int thread_id = 0; thread_id < cpu_util_full.size(); thread_id++) { - for (int history_id = 0; history_id < cpu_util_full[thread_id].size(); history_id++) { - section["cpu"][thread_id].append(cpu_util_full[thread_id][history_id]); + + /* history */ + for (int history_id = 0; history_id < cpu_util_full[thread_id].m_history.size(); history_id++) { + section["cpu"][thread_id]["history"].append(cpu_util_full[thread_id].m_history[history_id]); } + + /* ports */ + section["cpu"][thread_id]["ports"] = Json::arrayValue; + section["cpu"][thread_id]["ports"].append(cpu_util_full[thread_id].m_port1); + section["cpu"][thread_id]["ports"].append(cpu_util_full[thread_id].m_port2); } + return (TREX_RPC_CMD_OK); } @@ -270,6 +278,7 @@ TrexRpcCmdGetSysInfo::_run(const Json::Value ¶ms, Json::Value &result) { /* FIXME: core count */ section["dp_core_count"] = main->get_dp_core_count(); + section["dp_core_count_per_port"] = main->get_dp_core_count() / (main->get_port_count() / 2); section["core_type"] = get_cpu_model(); /* ports */ diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp index 736f3d02..7e973e60 100644 --- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp +++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp @@ -542,8 +542,13 @@ TrexRpcCmdStartTraffic::_run(const Json::Value ¶ms, Json::Value &result) { uint8_t port_id = parse_port(params, result); TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(port_id); - double duration = parse_double(params, "duration", result); - bool force = parse_bool(params, "force", result); + double duration = parse_double(params, "duration", result); + bool force = parse_bool(params, "force", result); + uint64_t core_mask = parse_uint64(params, "core_mask", result); + + if (!TrexDPCoreMask::is_valid_mask(port->get_dp_core_count(), core_mask)) { + generate_parse_err(result, "invalid core mask provided"); + } /* multiplier */ const Json::Value &mul_obj = parse_object(params, "mul", result); @@ -551,7 +556,7 @@ TrexRpcCmdStartTraffic::_run(const Json::Value ¶ms, Json::Value &result) { std::string type = parse_choice(mul_obj, "type", TrexPortMultiplier::g_types, result); std::string op = parse_string(mul_obj, "op", result); double value = parse_double(mul_obj, "value", result); - + if ( value <=0 ){ generate_parse_err(result, "multiplier can't be zero"); } @@ -563,7 +568,7 @@ TrexRpcCmdStartTraffic::_run(const Json::Value ¶ms, Json::Value &result) { TrexPortMultiplier mul(type, op, value); try { - port->start_traffic(mul, duration, force); + port->start_traffic(mul, duration, force, core_mask); } catch (const TrexException &ex) { generate_execute_err(result, ex.what()); diff --git a/src/rpc-server/commands/trex_rpc_cmds.h b/src/rpc-server/commands/trex_rpc_cmds.h index 24b95227..9dde61d4 100644 --- a/src/rpc-server/commands/trex_rpc_cmds.h +++ b/src/rpc-server/commands/trex_rpc_cmds.h @@ -121,7 +121,7 @@ TREX_RPC_CMD_DEFINE(TrexRpcCmdGetStream, "get_stream", 3, false, APIClass::API_C -TREX_RPC_CMD_DEFINE(TrexRpcCmdStartTraffic, "start_traffic", 4, true, APIClass::API_CLASS_TYPE_CORE); +TREX_RPC_CMD_DEFINE(TrexRpcCmdStartTraffic, "start_traffic", 5, true, APIClass::API_CLASS_TYPE_CORE); TREX_RPC_CMD_DEFINE(TrexRpcCmdStopTraffic, "stop_traffic", 1, true, APIClass::API_CLASS_TYPE_CORE); TREX_RPC_CMD_DEFINE(TrexRpcCmdRemoveRXFilters, "remove_rx_filters", 1, true, APIClass::API_CLASS_TYPE_CORE); TREX_RPC_CMD_DEFINE(TrexRpcCmdPauseTraffic, "pause_traffic", 1, true, APIClass::API_CLASS_TYPE_CORE); |