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 <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
Andrew Deason 2021-08-01 16:29:36 -05:00
parent 28bc6daa26
commit ef7aeddec1

View File

@ -223,12 +223,17 @@ fs_stateRestore(void)
{ {
int ret = 0; int ret = 0;
struct fs_dump_state state; 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 */ /* save and restore need to be atomic wrt other host package operations */
H_LOCK; H_LOCK;
ViceLog(0, ("fs_stateRestore: commencing fileserver state restore\n")); 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)) { if (fs_stateAlloc(&state)) {
ViceLog(0, ("fs_stateRestore: memory allocation failed\n")); ViceLog(0, ("fs_stateRestore: memory allocation failed\n"));
ret = 1; ret = 1;
@ -294,7 +299,13 @@ fs_stateRestore(void)
ViceLog(0, ("fs_stateRestore: fileserver state verification complete\n")); 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: done:
if (state.fd >= 0) { if (state.fd >= 0) {