diff options
Diffstat (limited to 'net/sunrpc/stats.c')
-rw-r--r-- | net/sunrpc/stats.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 5785d2037f45..ea1046f3f9a3 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
@@ -144,7 +144,7 @@ void rpc_count_iostats(struct rpc_task *task) | |||
144 | struct rpc_rqst *req = task->tk_rqstp; | 144 | struct rpc_rqst *req = task->tk_rqstp; |
145 | struct rpc_iostats *stats; | 145 | struct rpc_iostats *stats; |
146 | struct rpc_iostats *op_metrics; | 146 | struct rpc_iostats *op_metrics; |
147 | long rtt, execute, queue; | 147 | ktime_t delta; |
148 | 148 | ||
149 | if (!task->tk_client || !task->tk_client->cl_metrics || !req) | 149 | if (!task->tk_client || !task->tk_client->cl_metrics || !req) |
150 | return; | 150 | return; |
@@ -156,23 +156,16 @@ void rpc_count_iostats(struct rpc_task *task) | |||
156 | op_metrics->om_ntrans += req->rq_ntrans; | 156 | op_metrics->om_ntrans += req->rq_ntrans; |
157 | op_metrics->om_timeouts += task->tk_timeouts; | 157 | op_metrics->om_timeouts += task->tk_timeouts; |
158 | 158 | ||
159 | op_metrics->om_bytes_sent += task->tk_bytes_sent; | 159 | op_metrics->om_bytes_sent += req->rq_xmit_bytes_sent; |
160 | op_metrics->om_bytes_recv += req->rq_reply_bytes_recvd; | 160 | op_metrics->om_bytes_recv += req->rq_reply_bytes_recvd; |
161 | 161 | ||
162 | queue = (long)req->rq_xtime - task->tk_start; | 162 | delta = ktime_sub(req->rq_xtime, task->tk_start); |
163 | if (queue < 0) | 163 | op_metrics->om_queue = ktime_add(op_metrics->om_queue, delta); |
164 | queue = -queue; | ||
165 | op_metrics->om_queue += queue; | ||
166 | 164 | ||
167 | rtt = task->tk_rtt; | 165 | op_metrics->om_rtt = ktime_add(op_metrics->om_rtt, req->rq_rtt); |
168 | if (rtt < 0) | ||
169 | rtt = -rtt; | ||
170 | op_metrics->om_rtt += rtt; | ||
171 | 166 | ||
172 | execute = (long)jiffies - task->tk_start; | 167 | delta = ktime_sub(ktime_get(), task->tk_start); |
173 | if (execute < 0) | 168 | op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta); |
174 | execute = -execute; | ||
175 | op_metrics->om_execute += execute; | ||
176 | } | 169 | } |
177 | 170 | ||
178 | static void _print_name(struct seq_file *seq, unsigned int op, | 171 | static void _print_name(struct seq_file *seq, unsigned int op, |
@@ -186,8 +179,6 @@ static void _print_name(struct seq_file *seq, unsigned int op, | |||
186 | seq_printf(seq, "\t%12u: ", op); | 179 | seq_printf(seq, "\t%12u: ", op); |
187 | } | 180 | } |
188 | 181 | ||
189 | #define MILLISECS_PER_JIFFY (1000 / HZ) | ||
190 | |||
191 | void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) | 182 | void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) |
192 | { | 183 | { |
193 | struct rpc_iostats *stats = clnt->cl_metrics; | 184 | struct rpc_iostats *stats = clnt->cl_metrics; |
@@ -214,9 +205,9 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) | |||
214 | metrics->om_timeouts, | 205 | metrics->om_timeouts, |
215 | metrics->om_bytes_sent, | 206 | metrics->om_bytes_sent, |
216 | metrics->om_bytes_recv, | 207 | metrics->om_bytes_recv, |
217 | metrics->om_queue * MILLISECS_PER_JIFFY, | 208 | ktime_to_ms(metrics->om_queue), |
218 | metrics->om_rtt * MILLISECS_PER_JIFFY, | 209 | ktime_to_ms(metrics->om_rtt), |
219 | metrics->om_execute * MILLISECS_PER_JIFFY); | 210 | ktime_to_ms(metrics->om_execute)); |
220 | } | 211 | } |
221 | } | 212 | } |
222 | EXPORT_SYMBOL_GPL(rpc_print_iostats); | 213 | EXPORT_SYMBOL_GPL(rpc_print_iostats); |