aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorSunil Mushran <sunil.mushran@oracle.com>2010-12-22 15:39:41 -0500
committerJoel Becker <joel.becker@oracle.com>2010-12-22 21:38:10 -0500
commite453039f8bf44abf82f3ecfb34177e0cb04bce12 (patch)
tree2e929b520261d57f6ee8bdafe1aeeb0a18e1a7d8 /fs/ocfs2
parent3c193b3807e933cf2a16d55a38debbe549195847 (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')
-rw-r--r--fs/ocfs2/cluster/tcp.c15
-rw-r--r--fs/ocfs2/cluster/tcp_internal.h2
2 files changed, 17 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
213static 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
249static 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
1241out_respond: 1256out_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);
diff --git a/fs/ocfs2/cluster/tcp_internal.h b/fs/ocfs2/cluster/tcp_internal.h
index 640c6fcef720..4cbcb65784a3 100644
--- a/fs/ocfs2/cluster/tcp_internal.h
+++ b/fs/ocfs2/cluster/tcp_internal.h
@@ -184,6 +184,8 @@ struct o2net_sock_container {
184 ktime_t sc_tv_send_total; 184 ktime_t sc_tv_send_total;
185 ktime_t sc_tv_status_total; 185 ktime_t sc_tv_status_total;
186 u32 sc_send_count; 186 u32 sc_send_count;
187 u32 sc_recv_count;
188 ktime_t sc_tv_process_total;
187#endif 189#endif
188 struct mutex sc_send_lock; 190 struct mutex sc_send_lock;
189}; 191};