本文整理汇总了C++中TrexStatelessPort::start_traffic_max_pps方法的典型用法代码示例。如果您正苦于以下问题:C++ TrexStatelessPort::start_traffic_max_pps方法的具体用法?C++ TrexStatelessPort::start_traffic_max_pps怎么用?C++ TrexStatelessPort::start_traffic_max_pps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrexStatelessPort
的用法示例。
在下文中一共展示了TrexStatelessPort::start_traffic_max_pps方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/***************************
* start traffic on port
*
**************************/
trex_rpc_cmd_rc_e
TrexRpcCmdStartTraffic::_run(const Json::Value ¶ms, Json::Value &result) {
uint8_t port_id = parse_byte(params, "port_id", result);
double duration = parse_double(params, "duration", result);
if (port_id >= get_stateless_obj()->get_port_count()) {
std::stringstream ss;
ss << "invalid port id - should be between 0 and " << (int)get_stateless_obj()->get_port_count() - 1;
generate_execute_err(result, ss.str());
}
TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(port_id);
const Json::Value &mul = parse_object(params, "mul", result);
std::string mul_type = parse_string(mul, "type", result);
/* dispatch according to type of multiplier */
try {
if (mul_type == "raw") {
double m = parse_double(mul, "factor", result);
port->start_traffic(m, duration);
} else if (mul_type == "max_bps") {
double max_bps = parse_double(mul, "max", result);
port->start_traffic_max_bps(max_bps, duration);
} else if (mul_type == "max_pps") {
double max_pps = parse_double(mul, "max", result);
port->start_traffic_max_pps(max_pps, duration);
}
} catch (const TrexRpcException &ex) {
generate_execute_err(result, ex.what());
}
result["result"] = "ACK";
return (TREX_RPC_CMD_OK);
}