Skip to content

Commit e453039

Browse files
Sunil MushranJoel Becker
authored andcommitted
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>
1 parent 3c193b3 commit e453039

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎fs/ocfs2/cluster/tcp.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ static inline void o2net_set_func_stop_time(struct o2net_sock_container *sc)
209209
{
210210
sc->sc_tv_func_stop = ktime_get();
211211
}
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+
}
212217
#else /* CONFIG_DEBUG_FS */
213218
# define o2net_init_nst(a, b, c, d, e)
214219
# define o2net_set_nst_sock_time(a)
@@ -222,6 +227,7 @@ static inline void o2net_set_func_stop_time(struct o2net_sock_container *sc)
222227
# define o2net_set_advance_stop_time(a)
223228
# define o2net_set_func_start_time(a)
224229
# define o2net_set_func_stop_time(a)
230+
# define o2net_get_func_run_time(a) (ktime_t)0
225231
#endif /* CONFIG_DEBUG_FS */
226232

227233
#ifdef CONFIG_OCFS2_FS_STATS
@@ -240,6 +246,13 @@ static void o2net_update_send_stats(struct o2net_send_tracking *nst,
240246
sc->sc_send_count++;
241247
}
242248

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+
243256
#else
244257

245258
# define o2net_update_send_stats(a, b)
@@ -1238,6 +1251,8 @@ static int o2net_process_message(struct o2net_sock_container *sc,
12381251
nmh->nh_func_data, &ret_data);
12391252
o2net_set_func_stop_time(sc);
12401253

1254+
o2net_update_recv_stats(sc);
1255+
12411256
out_respond:
12421257
/* this destroys the hdr, so don't use it after this */
12431258
mutex_lock(&sc->sc_send_lock);

‎fs/ocfs2/cluster/tcp_internal.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ struct o2net_sock_container {
184184
ktime_t sc_tv_send_total;
185185
ktime_t sc_tv_status_total;
186186
u32 sc_send_count;
187+
u32 sc_recv_count;
188+
ktime_t sc_tv_process_total;
187189
#endif
188190
struct mutex sc_send_lock;
189191
};

0 commit comments

Comments
 (0)