本文整理汇总了C++中TrexStatelessPort::get_port_speed_bps方法的典型用法代码示例。如果您正苦于以下问题:C++ TrexStatelessPort::get_port_speed_bps方法的具体用法?C++ TrexStatelessPort::get_port_speed_bps怎么用?C++ TrexStatelessPort::get_port_speed_bps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrexStatelessPort
的用法示例。
在下文中一共展示了TrexStatelessPort::get_port_speed_bps方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
/***************************
* validate
*
* checks that the port
* attached streams are
* valid as a program
**************************/
trex_rpc_cmd_rc_e
TrexRpcCmdValidate::_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);
const TrexStreamsGraphObj *graph = NULL;
try {
graph = port->validate();
}
catch (const TrexException &ex) {
generate_execute_err(result, ex.what());
}
result["result"]["rate"]["max_bps"] = graph->get_max_bps();
result["result"]["rate"]["max_pps"] = graph->get_max_pps();
result["result"]["rate"]["max_line_util"] = graph->get_max_bps() / port->get_port_speed_bps();
result["result"]["graph"]["expected_duration"] = graph->get_duration();
result["result"]["graph"]["events_count"] = (int)graph->get_events().size();
result["result"]["graph"]["events"] = Json::arrayValue;
Json::Value &events_json = result["result"]["graph"]["events"];
int index = 0;
for (const auto &ev : graph->get_events()) {
Json::Value ev_json;
ev_json["time_usec"] = ev.time;
ev_json["diff_bps"] = ev.diff_bps;
ev_json["diff_pps"] = ev.diff_pps;
ev_json["stream_id"] = ev.stream_id;
events_json.append(ev_json);
index++;
if (index >= 100) {
break;
}
}
return (TREX_RPC_CMD_OK);
}