diff options
author | imarom <imarom@cisco.com> | 2016-08-18 13:49:59 +0300 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2016-08-18 13:52:49 +0300 |
commit | b8353aa9eb017f66166da9ee03ad7cd09abda175 (patch) | |
tree | 416cd03e701fdb2209034d04ea37bdc8a21bf3f4 /src/main_dpdk.cpp | |
parent | 5f530a21aa669b4ddc0f8d0329794d0c439f6879 (diff) |
CPU util. measurements fix (more accurate and steady)
see #trex-246
Diffstat (limited to 'src/main_dpdk.cpp')
-rw-r--r-- | src/main_dpdk.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index 6beb4e3e..0ef83c02 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -4126,15 +4126,21 @@ void CGlobalTRex::handle_fast_path() { /* check from messages from DP */ check_for_dp_messages(); - // update CPU% - m_fl.UpdateFast(); - if (get_is_stateless()) { - m_rx_sl.update_cpu_util(); - }else{ - m_mg.update_fast(); + /* measure CPU utilization by sampling (we sample 1000 to get an accurate sampling) */ + for (int i = 0; i < 1000; i++) { + m_fl.UpdateFast(); + + if (get_is_stateless()) { + m_rx_sl.update_cpu_util(); + }else{ + m_mg.update_fast(); + } + + rte_pause(); } + if ( is_all_cores_finished() ) { mark_for_shutdown(SHUTDOWN_TEST_ENDED); } |