summaryrefslogtreecommitdiffstats
path: root/src/main_dpdk.cpp
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-04-28 20:32:44 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-04-28 20:32:44 +0300
commit101c7b8b5f1e7e9eeb4df9d79e68c15cd0d49ef7 (patch)
treebcf6aee5b6249467e4c9a82b5dfb77dca5321076 /src/main_dpdk.cpp
parent798efac6db9d057073dae13b818815422ae926cc (diff)
increase accuracy of low values in json report (0.03 etc.)
Diffstat (limited to 'src/main_dpdk.cpp')
-rw-r--r--src/main_dpdk.cpp11
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() ) {