aboutsummaryrefslogtreecommitdiffstats
path: root/src/firemon/netstats.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/firemon/netstats.c')
-rw-r--r--src/firemon/netstats.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/firemon/netstats.c b/src/firemon/netstats.c
index 31abd5471..156efe67d 100644
--- a/src/firemon/netstats.c
+++ b/src/firemon/netstats.c
@@ -106,10 +106,8 @@ void get_stats(int parent) {
106 } 106 }
107 107
108 // store data 108 // store data
109 pids[parent].rx_delta = rx - pids[parent].rx; 109 pids[parent].option.netstats.rx = rx - pids[parent].option.netstats.rx;
110 pids[parent].rx = rx; 110 pids[parent].option.netstats.tx = tx - pids[parent].option.netstats.tx;
111 pids[parent].tx_delta = tx - pids[parent].tx;
112 pids[parent].tx = tx;
113 111
114 112
115 free(fname); 113 free(fname);
@@ -117,10 +115,8 @@ void get_stats(int parent) {
117 return; 115 return;
118 116
119errexit: 117errexit:
120 pids[parent].rx = 0; 118 pids[parent].option.netstats.rx = 0;
121 pids[parent].tx = 0; 119 pids[parent].option.netstats.tx = 0;
122 pids[parent].rx_delta = 0;
123 pids[parent].tx_delta = 0;
124} 120}
125 121
126 122
@@ -174,11 +170,11 @@ static void print_proc(int index, int itv, int col) {
174 ptruser = ""; 170 ptruser = "";
175 171
176 172
177 float rx_kbps = ((float) pids[index].rx_delta / 1000) / itv; 173 float rx_kbps = ((float) pids[index].option.netstats.rx / 1000) / itv;
178 char ptrrx[15]; 174 char ptrrx[15];
179 sprintf(ptrrx, "%.03f", rx_kbps); 175 sprintf(ptrrx, "%.03f", rx_kbps);
180 176
181 float tx_kbps = ((float) pids[index].tx_delta / 1000) / itv; 177 float tx_kbps = ((float) pids[index].option.netstats.tx / 1000) / itv;
182 char ptrtx[15]; 178 char ptrtx[15];
183 sprintf(ptrtx, "%.03f", tx_kbps); 179 sprintf(ptrtx, "%.03f", tx_kbps);
184 180