diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main_dpdk.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index 1496513d..9a66db51 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -2335,7 +2335,10 @@ private: std::string CGlobalStats::get_field(std::string name,float &f){ char buff[200]; - snprintf(buff, sizeof(buff), "\"%s\":%.1f,",name.c_str(),f); + if(f >= 10 || f <= -10) + snprintf(buff, sizeof(buff), "\"%s\":%.1f,",name.c_str(),f); + else + snprintf(buff, sizeof(buff), "\"%s\":%.3e,",name.c_str(),f); return (std::string(buff)); } @@ -2347,7 +2350,10 @@ std::string CGlobalStats::get_field(std::string name,uint64_t &f){ std::string CGlobalStats::get_field_port(int port,std::string name,float &f){ char buff[200]; - snprintf(buff, sizeof(buff), "\"%s-%d\":%.1f,",name.c_str(),port,f); + if(f >= 10 || f <= -10) + snprintf(buff, sizeof(buff), "\"%s-%d\":%.1f,",name.c_str(),port,f); + else + snprintf(buff, sizeof(buff), "\"%s-%d\":%.3e,",name.c_str(),port,f); return (std::string(buff)); } @@ -2442,6 +2448,7 @@ void CGlobalStats::DumpAllPorts(FILE *fd){ fprintf (fd," Cpu Utilization : %2.1f %% %2.1f Gb/core \n",m_cpu_util,(2*(m_tx_bps/1e9)*100.0/(m_cpu_util*m_threads))); + fprintf (fd,"tx_bps: %2.1f, m_cpu_util: %2.5f, m_threads: %2.1f", (double) m_tx_bps, (double) m_cpu_util, (double) m_threads); fprintf (fd," Platform_factor : %2.1f \n",m_platform_factor); fprintf (fd," Total-Tx : %s ",double_to_human_str(m_tx_bps,"bps",KBYE_1000).c_str()); if ( CGlobalInfo::is_learn_mode() ) { |