diff options
author | netblue30 <netblue30@protonmail.com> | 2022-06-02 17:03:36 -0400 |
---|---|---|
committer | netblue30 <netblue30@protonmail.com> | 2022-06-02 17:03:36 -0400 |
commit | 741aaa4f59f3604f6c139fedcf06c0a2f910a60c (patch) | |
tree | a899d718e3ef65b7553eadc858eeb5b1a482fe97 /src/firemon/netstats.c | |
parent | speed up firemon (diff) | |
download | firejail-741aaa4f59f3604f6c139fedcf06c0a2f910a60c.tar.gz firejail-741aaa4f59f3604f6c139fedcf06c0a2f910a60c.tar.zst firejail-741aaa4f59f3604f6c139fedcf06c0a2f910a60c.zip |
firemon rework
Diffstat (limited to 'src/firemon/netstats.c')
-rw-r--r-- | src/firemon/netstats.c | 16 |
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 | ||
119 | errexit: | 117 | errexit: |
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 | ||