diff options
author | 2016-05-18 16:53:42 +0300 | |
---|---|---|
committer | 2016-05-18 19:23:58 +0300 | |
commit | cc2abc13f1f74612b211d3cd235341745b16bd49 (patch) | |
tree | a35f5b0e0f9388d4be5ca25337fa6dbef2c0d8a9 | |
parent | 91120a37444f8a2f5e1d676f9a091f54346a3cfd (diff) |
Change to latency python + small fixes
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py | 16 | ||||
-rw-r--r-- | src/flow_stat.cpp | 4 | ||||
-rw-r--r-- | src/rpc-server/commands/trex_rpc_cmd_general.cpp | 2 | ||||
-rw-r--r-- | src/stateless/rx/trex_stateless_rx_core.cpp | 6 |
4 files changed, 20 insertions, 8 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py index e1100b17..7c5a23cb 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py @@ -868,7 +868,8 @@ class CLatencyStats(CTRexStats): # for API def get_stats (self): - return self.latest_stats + ret = copy.deepcopy(self.latest_stats) + return ret def _update(self, snapshot): @@ -884,8 +885,17 @@ class CLatencyStats(CTRexStats): current_pg = snapshot.get(pg_id) int_pg_id = int(pg_id) output[int_pg_id] = {} - for field in ['err_cntrs', 'latency']: - output[int_pg_id][field] = current_pg[field] + output[int_pg_id]['err_cntrs'] = current_pg['err_cntrs'] + output[int_pg_id]['latency'] = {} + + output[int_pg_id]['latency']['last_max'] = current_pg['latency']['last_max'] + output[int_pg_id]['latency']['jitter'] = current_pg['latency']['jitter'] + if current_pg['latency']['h'] != "": + output[int_pg_id]['latency']['average'] = current_pg['latency']['h']['s_avg'] + output[int_pg_id]['latency']['total_max'] = current_pg['latency']['h']['max_usec'] + output[int_pg_id]['latency']['histogram'] = current_pg['latency']['h']['histogram'] + zero_count = current_pg['latency']['h']['cnt'] - current_pg['latency']['h']['high_cnt'] + output[int_pg_id]['latency']['histogram'].append({'key':0, 'val':zero_count}) self.latest_stats = output return True diff --git a/src/flow_stat.cpp b/src/flow_stat.cpp index 7f086ab3..1a3e54aa 100644 --- a/src/flow_stat.cpp +++ b/src/flow_stat.cpp @@ -1049,13 +1049,13 @@ bool CFlowStatRuleMgr::dump_json(std::string & s_json, std::string & l_json, boo rfc2544_info[hw_id].get_latency_json(lat_hist); user_id_info_p->set_seq_err_cnt(rfc2544_info[hw_id].get_seq_err_cnt()); user_id_info_p->set_ooo_cnt(rfc2544_info[hw_id].get_ooo_cnt()); - l_data_section[str_user_id]["latency"] = lat_hist; + l_data_section[str_user_id]["latency"]["h"] = lat_hist; l_data_section[str_user_id]["latency"]["last_max"] = rfc2544_info[hw_id].get_last_max_usec(); l_data_section[str_user_id]["latency"]["jitter"] = rfc2544_info[hw_id].get_jitter_usec(); } else { // Not mapped to hw_id. Get saved info. user_id_info_p->get_latency_json(lat_hist); - l_data_section[str_user_id]["latency"]["histogram"] = lat_hist; + l_data_section[str_user_id]["latency"]["h"] = lat_hist; l_data_section[str_user_id]["latency"]["last_max"] = 0; l_data_section[str_user_id]["latency"]["jitter"] = user_id_info_p->get_jitter_usec(); } diff --git a/src/rpc-server/commands/trex_rpc_cmd_general.cpp b/src/rpc-server/commands/trex_rpc_cmd_general.cpp index fa6340b9..68ea2587 100644 --- a/src/rpc-server/commands/trex_rpc_cmd_general.cpp +++ b/src/rpc-server/commands/trex_rpc_cmd_general.cpp @@ -263,7 +263,7 @@ TrexRpcCmdGetSysInfo::_run(const Json::Value ¶ms, Json::Value &result) { if (caps & TrexPlatformApi::IF_STAT_PAYLOAD) { section["ports"][i]["rx"]["caps"].append("latency"); } - if (caps & TrexPlatformApi::IF_STAT_IPV4_ID) { + if (caps & TrexPlatformApi::IF_STAT_RX_BYTES_COUNT) { section["ports"][i]["rx"]["caps"].append("rx_bytes"); } section["ports"][i]["rx"]["counters"] = port->get_rx_count_num(); diff --git a/src/stateless/rx/trex_stateless_rx_core.cpp b/src/stateless/rx/trex_stateless_rx_core.cpp index 39ecb4f2..7239626e 100644 --- a/src/stateless/rx/trex_stateless_rx_core.cpp +++ b/src/stateless/rx/trex_stateless_rx_core.cpp @@ -153,7 +153,8 @@ void CRxCoreStateless::handle_rx_pkt(CLatencyManagerPerPortStl *lp, rte_mbuf_t * } else { m_rfc2544[hw_id].out_of_order += 1; // We thought it was lost, but it was just out of order - m_rfc2544[hw_id].seq_err -= 1; + if (m_rfc2544[hw_id].seq_err > 0) + m_rfc2544[hw_id].seq_err -= 1; } m_rfc2544[hw_id].seq_err_events_too_low++; } @@ -165,7 +166,8 @@ void CRxCoreStateless::handle_rx_pkt(CLatencyManagerPerPortStl *lp, rte_mbuf_t * } else { m_rfc2544[hw_id].out_of_order += 1; // We thought it was lost, but it was just out of order - m_rfc2544[hw_id].seq_err -= 1; + if (m_rfc2544[hw_id].seq_err > 0) + m_rfc2544[hw_id].seq_err -= 1; } m_rfc2544[hw_id].seq_err_events_too_low++; } else { |