From ef7aeddec1cd6ba060a076f2c81569a1726769cc Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Sun, 1 Aug 2021 16:29:36 -0500 Subject: [PATCH] viced: Log some basic fs_stateRestore stats Log how long it took to restore our fsstate.dat data, and how many FEs/CBs we loaded. This may be of interest to anyone looking at the impact of different relevant options (such as -fs-state-verify), and how much callback state is being restored. Note that we're not adding any new messages, just adding some additional info to an existing message. Change-Id: I86bc384919d1c6c141558c23d2c53def2e8916f8 Reviewed-on: https://gerrit.openafs.org/14737 Reviewed-by: Cheyenne Wills Reviewed-by: Mark Vitale Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Tested-by: Andrew Deason --- src/viced/serialize_state.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/viced/serialize_state.c b/src/viced/serialize_state.c index 22d2a70e7e..a84d4f08ca 100644 --- a/src/viced/serialize_state.c +++ b/src/viced/serialize_state.c @@ -223,12 +223,17 @@ fs_stateRestore(void) { int ret = 0; struct fs_dump_state state; + struct timeval now; + afs_int64 start_ms, end_ms, diff_ms; /* save and restore need to be atomic wrt other host package operations */ H_LOCK; ViceLog(0, ("fs_stateRestore: commencing fileserver state restore\n")); + opr_Verify(gettimeofday(&now, NULL) == 0); + start_ms = now.tv_sec * 1000 + now.tv_usec / 1000; + if (fs_stateAlloc(&state)) { ViceLog(0, ("fs_stateRestore: memory allocation failed\n")); ret = 1; @@ -294,7 +299,13 @@ fs_stateRestore(void) ViceLog(0, ("fs_stateRestore: fileserver state verification complete\n")); } - ViceLog(0, ("fs_stateRestore: restore was successful\n")); + opr_Verify(gettimeofday(&now, NULL) == 0); + end_ms = now.tv_sec * 1000 + now.tv_usec / 1000; + diff_ms = end_ms - start_ms; + + ViceLog(0, ("fs_stateRestore: restore was successful in %lld ms " + "(%d FEs, %d CBs)\n", + diff_ms, state.cb_hdr->nFEs, state.cb_hdr->nCBs)); done: if (state.fd >= 0) {