xstat: cm xstat time values are 32 bit
[openafs.git] / src / afs / afs_stats.h
index 2fa76aa..60f2e93 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
@@ -35,6 +35,7 @@
 #define AFS_STATS(arg)
 #define XSTATS_DECLS
 #define XSTATS_START_TIME(arg)
+#define XSTATS_START_CMTIME(arg)
 #define XSTATS_END_TIME
 
 #else /* AFS_NOSTATS */
 #define AFS_STATS(arg) arg
 #ifndef KERNEL
 /* NOTE: Ensure this is the same size in user and kernel mode. */
-typedef struct timeval osi_timeval_t;
+typedef struct {
+    afs_int32 tv_sec;
+    afs_int32 tv_usec;
+} osi_timeval32_t;
 #endif /* !KERNEL */
 
-#define XSTATS_DECLS struct afs_stats_opTimingData *opP; \
-    osi_timeval_t opStartTime, opStopTime, elapsedTime
+#define XSTATS_DECLS struct afs_stats_opTimingData *opP = NULL; \
+    osi_timeval_t opStartTime = { 0, 0}, opStopTime, elapsedTime
 
 #define XSTATS_START_TIME(arg) \
   opP = &(afs_stats_cmfullperf.rpc.fsRPCTimes[arg]); \
@@ -80,6 +84,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 */
@@ -639,6 +655,10 @@ 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 */
+    afs_int32 C_BPrefetchNoCache;      /* afs_daemons.c */
+    afs_int32 C_afs_ReadNoCache;       /* osi_vnodeops.c */
+    afs_int32 C_PSetTokens2;           /* afs_pioctl.c */
+    afs_int32 C_PPrefetchFromTape;     /* afs_pioctl.c */
 };
 
 struct afs_CMMeanStats {
@@ -802,10 +822,14 @@ struct afs_stats_CMPerf {
     afs_uint32 cbloops;
     afs_uint32 osiread_efaults;
     afs_int32 cacheBlocksDiscarded;    /*# cache blocks free but not truncated */
+    afs_int32 cacheBucket0_Discarded;
+    afs_int32 cacheBucket1_Discarded;
+    afs_int32 cacheBucket2_Discarded;
+
     /*
      * Spares for future expansion.
      */
-    afs_int32 spare[13];       /*Spares */
+    afs_int32 spare[10];       /*Spares */
 };
 
 
@@ -867,10 +891,10 @@ struct afs_stats_CMPerf {
 struct afs_stats_opTimingData {
     afs_int32 numOps;          /*Number of operations executed */
     afs_int32 numSuccesses;    /*Number of successful ops */
-    osi_timeval_t sumTime;     /*Sum of sample timings */
-    osi_timeval_t sqrTime;     /*Sum of squares of sample timings */
-    osi_timeval_t minTime;     /*Minimum timing value observed */
-    osi_timeval_t maxTime;     /*Minimum timing value observed */
+    osi_timeval32_t sumTime;   /*Sum of sample timings */
+    osi_timeval32_t sqrTime;   /*Sum of squares of sample timings */
+    osi_timeval32_t minTime;   /*Minimum timing value observed */
+    osi_timeval32_t maxTime;   /*Minimum timing value observed */
 };
 
 /*
@@ -893,10 +917,10 @@ struct afs_stats_opTimingData {
 struct afs_stats_xferData {
     afs_int32 numXfers;                /*Number of successful xfers */
     afs_int32 numSuccesses;    /*Number of successful xfers */
-    osi_timeval_t sumTime;     /*Sum of timing values */
-    osi_timeval_t sqrTime;     /*Sum of squares of timing values */
-    osi_timeval_t minTime;     /*Minimum xfer time recorded */
-    osi_timeval_t maxTime;     /*Maximum xfer time recorded */
+    osi_timeval32_t sumTime;   /*Sum of timing values */
+    osi_timeval32_t sqrTime;   /*Sum of squares of timing values */
+    osi_timeval32_t minTime;   /*Minimum xfer time recorded */
+    osi_timeval32_t maxTime;   /*Maximum xfer time recorded */
     afs_int32 sumBytes;                /*Sum of KBytes transferred */
     afs_int32 minBytes;                /*Minimum value observed */
     afs_int32 maxBytes;                /*Maximum value observed */
@@ -990,7 +1014,7 @@ struct afs_stats_xferData {
  * integer portion (this will be taken care of when we ensure that y'
  * is less than 1000000).
  *
- * The only other non-obvious calculation involves y^2.  The key to 
+ * The only other non-obvious calculation involves y^2.  The key to
  * understanding this part of the calculation is to expand y again
  * in a nonobvious manner.  We do this via the following expansion:
  *