[OpenAFS-devel] Fileserver callback counters made accessible through xstat_fs_test

Rainer Toebbicke rtb@pclella.cern.ch
Thu, 09 Mar 2006 09:16:37 +0100


This is a multi-part message in MIME format.
--------------070909070606060807030200
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

The attached patch makes the fileserver's callback counters accessible 
through xstat_fs_test (collection ID 3).

(It is useful that you can set the number of callback slots for the 
fileserver and even more so if you have a way to find out whether you 
did right).

One might argue that xstat_fs_test is stone-age and that afsmonitor 
would have been the infinitesimally more modern place to make them 
accessible. Both tools are virtually useless on their own but 
xstat_fs_test can at least be hooked up easily to something that fits 
in the 21st century. We monitor callbacks with MRTG, work on 
interfacing with EDG monitoring tools is under way.

(Bcc'ed to openafs-bugs)
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rainer Toebbicke
European Laboratory for Particle Physics(CERN) - Geneva, Switzerland
Phone: +41 22 767 8985       Fax: +41 22 767 7155

--------------070909070606060807030200
Content-Type: text/plain;
 name="patch_cbStats"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch_cbStats"

*** openafs/src/xstat/xstat_fs_test.c.o1381	2005-01-31 05:14:51.000000000 +0100
--- openafs/src/xstat/xstat_fs_test.c	2005-05-31 13:59:57.000000000 +0200
***************
*** 493,498 ****
--- 493,526 ----
      PrintOverallPerfInfo(perfP);
  }
  
+ static char *CbCounterStrings[] = {
+     "DeleteFiles",
+     "DeleteCallBacks",
+     "BreakCallBacks",
+     "AddCallBack",
+     "GotSomeSpaces",
+     "DeleteAllCallBacks",
+     "nFEs", "nCBs", "nblks",
+     "CBsTimedOut",
+     "nbreakers",
+     "GSS1", "GSS2", "GSS3", "GSS4", "GSS5"
+ };
+ 
+ 
+ void
+ PrintCbCounters() {
+     int numInt32s = sizeof(CbCounterStrings)/sizeof(char *);
+     int i;
+     afs_uint32 *val=xstat_fs_Results.data.AFS_CollData_val;
+ 
+     if (numInt32s > xstat_fs_Results.data.AFS_CollData_len)
+ 	numInt32s = xstat_fs_Results.data.AFS_CollData_len;
+ 
+     for (i=0; i<numInt32s; i++) {
+ 	printf("\t%10u %s\n", val[i], CbCounterStrings[i]);
+     }
+ }
+ 
  
  /*------------------------------------------------------------------------
   * FS_Handler
***************
*** 549,554 ****
--- 577,586 ----
  	PrintFullPerfInfo();
  	break;
  
+     case AFS_XSTATSCOLL_CBSTATS:
+ 	PrintCbCounters();
+ 	break;
+ 
      default:
  	printf("** Unknown collection: %d\n",
  	       xstat_fs_Results.collectionNumber);
*** openafs/src/viced/afsfileprocs.c.1rig	2005-04-06 10:32:03.000000000 +0200
--- openafs/src/viced/afsfileprocs.c	2005-05-31 12:29:52.000000000 +0200
***************
*** 5803,5808 ****
--- 5803,5838 ----
  #endif
  	break;
  
+     case AFS_XSTATSCOLL_CBSTATS:
+ 	afs_perfstats.numPerfCalls++;
+ 
+ 	dataBytes = sizeof(struct cbcounters);
+ 	dataBuffP = (afs_int32 *) malloc(dataBytes);
+ 	{
+ 	    extern struct cbcounters cbstuff;
+ 	    dataBuffP[0]=cbstuff.DeleteFiles;
+ 	    dataBuffP[1]=cbstuff.DeleteCallBacks;
+ 	    dataBuffP[2]=cbstuff.BreakCallBacks;
+ 	    dataBuffP[3]=cbstuff.AddCallBacks;
+ 	    dataBuffP[4]=cbstuff.GotSomeSpaces;
+ 	    dataBuffP[5]=cbstuff.DeleteAllCallBacks;
+ 	    dataBuffP[6]=cbstuff.nFEs;
+ 	    dataBuffP[7]=cbstuff.nCBs;
+ 	    dataBuffP[8]=cbstuff.nblks;
+ 	    dataBuffP[9]=cbstuff.CBsTimedOut;
+ 	    dataBuffP[10]=cbstuff.nbreakers;
+ 	    dataBuffP[11]=cbstuff.GSS1;
+ 	    dataBuffP[12]=cbstuff.GSS2;
+ 	    dataBuffP[13]=cbstuff.GSS3;
+ 	    dataBuffP[14]=cbstuff.GSS4;
+ 	    dataBuffP[15]=cbstuff.GSS5;
+ 	}
+ 
+ 	a_dataP->AFS_CollData_len = dataBytes >> 2;
+ 	a_dataP->AFS_CollData_val = dataBuffP;
+ 	break;
+ 
+ 
      default:
  	/*
  	 * Illegal collection number.
*** openafs/src/fsint/common.xg.o1382	2003-03-04 17:19:48.000000000 +0100
--- openafs/src/fsint/common.xg	2005-06-01 14:13:52.000000000 +0200
***************
*** 127,132 ****
--- 127,133 ----
  const AFS_XSTATSCOLL_CALL_INFO = 0;	 /*FS call counting & info*/
  const AFS_XSTATSCOLL_PERF_INFO = 1;	 /*FS performance info*/
  const AFS_XSTATSCOLL_FULL_PERF_INFO = 2; /*Full FS performance info*/
+ const AFS_XSTATSCOLL_CBSTATS = 3;	 /*Callback package counters */
  
  typedef afs_uint32 VolumeId;
  typedef afs_uint32 VolId;

--------------070909070606060807030200--