From 481098e04c686c351fee02221fbe6d890dc1a767 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sun, 7 Feb 2010 21:51:55 +0100 Subject: [PATCH] Unix CM: Tidy up the statistics interface Sort out the function call statistics interface. Whilst it's still wretched, this makes it a little less so. *) Add some warnings at the start of the afs_CMStats structure about what needs to be done when adding things there *) Remove the conditionals around the CacheBypass counters, so that stats clients don't need to be built with the same options as servers *) Add all of the stats entries added after IBM to the xstat_cm_test routine *) Add a warning to xstat_cm_test if the data returned from the server differs in size to the local stats structure. Change-Id: If1ffb68c84bca972f685ae619febba8c6f8b5e17 Reviewed-on: http://gerrit.openafs.org/1319 Reviewed-by: Alistair Ferguson Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/afs_stats.h | 16 +++++++++++++--- src/xstat/xstat_cm_test.c | 20 +++++++++++++++++++- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/afs/afs_stats.h b/src/afs/afs_stats.h index 2f3021656..73e01c2d9 100644 --- a/src/afs/afs_stats.h +++ b/src/afs/afs_stats.h @@ -81,6 +81,18 @@ struct afs_MeanStats { * struct afs_CMCallStats * This is the place where we keep records on each and every * function call. + * + * This structure is encoded as a binary blob and thrown at the client + * for use by the xstat_cm interface. As the datastructure is unversioned, + * some rules apply; + * *) Never add elements to the middle of the list. Everything new + * must go at the end + * *) Never remove elements from the list. If a function dies, don't + * remove it's entry here (by all means, flag it as dead, though) + * *) Never make elements conditional on preprocessor symbols. Doing + * this would mean that the client has to be built with exactly + * the same options as you are. Which isn't a great idea. + * */ struct afs_CMCallStats { afs_int32 C_afs_init; /* afs_aix_subr.c */ @@ -640,10 +652,8 @@ struct afs_CMCallStats { afs_int32 C_SRXAFSCB_GetCacheConfig; /* afs_callback.c */ afs_int32 C_SRXAFSCB_GetCE64; /* afs_callback.c */ afs_int32 C_SRXAFSCB_GetCellByNum; /* afs_callback.c */ -#if defined(AFS_CACHE_BYPASS) afs_int32 C_BPrefetchNoCache; /* afs_daemons.c */ - afs_int32 C_afs_ReadNoCache; /* osi_vnodeops.c */ -#endif + afs_int32 C_afs_ReadNoCache; /* osi_vnodeops.c */ }; struct afs_CMMeanStats { diff --git a/src/xstat/xstat_cm_test.c b/src/xstat/xstat_cm_test.c index a55839835..5ed9fb1af 100644 --- a/src/xstat/xstat_cm_test.c +++ b/src/xstat/xstat_cm_test.c @@ -162,13 +162,16 @@ print_cmCallStats(void) cmp = (struct afs_CMStats *)(xstat_cm_Results.data.AFSCB_CollData_val); + if (xstat_cm_Results.data.AFSCB_CollData_len != sizeof(struct afs_CMStats)) + printf("Data sets differ in size. Is cache manager a different version?"); + printf("\t%10d afs_init\n", cmp->callInfo.C_afs_init); printf("\t%10d gop_rdwr\n", cmp->callInfo.C_gop_rdwr); printf("\t%10d aix_gnode_rele\n", cmp->callInfo.C_aix_gnode_rele); printf("\t%10d gettimeofday\n", cmp->callInfo.C_gettimeofday); printf("\t%10d m_cpytoc\n", cmp->callInfo.C_m_cpytoc); printf("\t%10d aix_vattr_null\n", cmp->callInfo.C_aix_vattr_null); - printf("\t%10d afs_gn_frunc\n", cmp->callInfo.C_afs_gn_ftrunc); + printf("\t%10d afs_gn_ftrunc\n", cmp->callInfo.C_afs_gn_ftrunc); printf("\t%10d afs_gn_rdwr\n", cmp->callInfo.C_afs_gn_rdwr); printf("\t%10d afs_gn_ioctl\n", cmp->callInfo.C_afs_gn_ioctl); printf("\t%10d afs_gn_locktl\n", cmp->callInfo.C_afs_gn_lockctl); @@ -604,6 +607,21 @@ print_cmCallStats(void) printf("\t%10d afs_hp_strategy\n", cmp->callInfo.C_afs_hp_strategy); #endif printf("\t%10d PFlushMount\n", cmp->callInfo.C_PFlushMount); + printf("\t%10d SRXAFSCB_GetServerPrefs\n", + cmp->callInfo.C_SRXAFSCB_GetServerPrefs); + printf("\t%10d SRXAFSCB_GetCellServDB\n", + cmp->callInfo.C_SRXAFSCB_GetCellServDB); + printf("\t%10d SRXAFSCB_GetLocalCell\n", + cmp->callInfo.C_SRXAFSCB_GetLocalCell); + printf("\t%10d afs_MarshallCacheConfig\n", + cmp->callInfo.C_afs_MarshallCacheConfig); + printf("\t%10d SRXAFSCB_GetCacheConfig\n", + cmp->callInfo.C_SRXAFSCB_GetCacheConfig); + printf("\t%10d SRXAFSCB_GetCE64\n", cmp->callInfo.C_SRXAFSCB_GetCE64); + printf("\t%10d SRXAFSCB_GetCellByNum\n", + cmp->callInfo.C_SRXAFSCB_GetCellByNum); + printf("\t%10d BPrefetchNoCache\n", cmp->callInfo.C_BPrefetchNoCache); + printf("\t%10d afs_ReadNoCache\n", cmp->callInfo.C_afs_ReadNoCache); } -- 2.39.5