diff options
author | Sunil Mushran <sunil.mushran@oracle.com> | 2010-12-22 15:39:41 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-12-22 21:38:10 -0500 |
commit | e453039f8bf44abf82f3ecfb34177e0cb04bce12 (patch) | |
tree | 2e929b520261d57f6ee8bdafe1aeeb0a18e1a7d8 /fs/ocfs2/cluster/tcp.c | |
parent | 3c193b3807e933cf2a16d55a38debbe549195847 (diff) |
ocfs2/cluster: Track process message timing stats for each socket
Tracks total time taken to process messages received on a socket.
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/cluster/tcp.c')
-rw-r--r-- | fs/ocfs2/cluster/tcp.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 4d61e19d6146..bc2309554d0b 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -209,6 +209,11 @@ static inline void o2net_set_func_stop_time(struct o2net_sock_container *sc) | |||
209 | { | 209 | { |
210 | sc->sc_tv_func_stop = ktime_get(); | 210 | sc->sc_tv_func_stop = ktime_get(); |
211 | } | 211 | } |
212 | |||
213 | static ktime_t o2net_get_func_run_time(struct o2net_sock_container *sc) | ||
214 | { | ||
215 | return ktime_sub(sc->sc_tv_func_stop, sc->sc_tv_func_start); | ||
216 | } | ||
212 | #else /* CONFIG_DEBUG_FS */ | 217 | #else /* CONFIG_DEBUG_FS */ |
213 | # define o2net_init_nst(a, b, c, d, e) | 218 | # define o2net_init_nst(a, b, c, d, e) |
214 | # define o2net_set_nst_sock_time(a) | 219 | # define o2net_set_nst_sock_time(a) |
@@ -222,6 +227,7 @@ static inline void o2net_set_func_stop_time(struct o2net_sock_container *sc) | |||
222 | # define o2net_set_advance_stop_time(a) | 227 | # define o2net_set_advance_stop_time(a) |
223 | # define o2net_set_func_start_time(a) | 228 | # define o2net_set_func_start_time(a) |
224 | # define o2net_set_func_stop_time(a) | 229 | # define o2net_set_func_stop_time(a) |
230 | # define o2net_get_func_run_time(a) (ktime_t)0 | ||
225 | #endif /* CONFIG_DEBUG_FS */ | 231 | #endif /* CONFIG_DEBUG_FS */ |
226 | 232 | ||
227 | #ifdef CONFIG_OCFS2_FS_STATS | 233 | #ifdef CONFIG_OCFS2_FS_STATS |
@@ -240,6 +246,13 @@ static void o2net_update_send_stats(struct o2net_send_tracking *nst, | |||
240 | sc->sc_send_count++; | 246 | sc->sc_send_count++; |
241 | } | 247 | } |
242 | 248 | ||
249 | static void o2net_update_recv_stats(struct o2net_sock_container *sc) | ||
250 | { | ||
251 | sc->sc_tv_process_total = ktime_add(sc->sc_tv_process_total, | ||
252 | o2net_get_func_run_time(sc)); | ||
253 | sc->sc_recv_count++; | ||
254 | } | ||
255 | |||
243 | #else | 256 | #else |
244 | 257 | ||
245 | # define o2net_update_send_stats(a, b) | 258 | # define o2net_update_send_stats(a, b) |
@@ -1238,6 +1251,8 @@ static int o2net_process_message(struct o2net_sock_container *sc, | |||
1238 | nmh->nh_func_data, &ret_data); | 1251 | nmh->nh_func_data, &ret_data); |
1239 | o2net_set_func_stop_time(sc); | 1252 | o2net_set_func_stop_time(sc); |
1240 | 1253 | ||
1254 | o2net_update_recv_stats(sc); | ||
1255 | |||
1241 | out_respond: | 1256 | out_respond: |
1242 | /* this destroys the hdr, so don't use it after this */ | 1257 | /* this destroys the hdr, so don't use it after this */ |
1243 | mutex_lock(&sc->sc_send_lock); | 1258 | mutex_lock(&sc->sc_send_lock); |