Hi,

This is the other scripts, which prints different AFS operations being
requested by each client.
Similarily to the previous one - it is a very quickly written script, only
tested on our 1.4.11 based tree (with lots of patches, specifically DAFS),
but there is a good chance it will just work on 1.4.11+ and maybe even on
1.6 (I haven't tried it though). It makes some very specific assumptions
about how a given release of OpenAFS works, and it might not work correctly
or at all for you - although it should be trivial to fix it then.

Also notice, that either script is not necessarily the best way (or even
correct way) to get the stats, but they worked for me.

Please use it at your own risk.

The script requires two arguments - pid of fileserver, and how often it
should print its output (for example 5s).
It then clears terminal at a specified interval and prints the statistics.

Example output:
 
# ./rx_clients.d `pgrep fileserver` 5s

CLIENT IP         CONN CONN/s MKFILE RMFILE  MKDIR  RMDIR RENAME LOOKUP  
LINK SYMLNK SSTORE DSTORE 
=============== ====== ====== ====== ====== ====== ====== ====== ======
====== ====== ====== ======
172.24.40.236     6009    133    234    702    234    234      0      0   
234    235    235      0
172.24.3.188       178      3      0      1      0      0      0      0     
0      0      3      0
172.24.41.86         2      0      0      0      0      0      0      0     
0      0      0      0
10.172.170.236       2      0      0      0      0      0      0      0     
0      0      0      0
                ====== ====== ====== ====== ====== ====== ====== ======
====== ====== ====== ======
                  6191    137    234    703    234    234      0      0   
234    235    238      0
 

   started: 2010 Nov  8 13:13:16
   current: 2010 Nov  8 13:14:01
 

        SSTORE = Store Status
        DSTORE = Store Data


# cat rx_clients.d
#!/usr/sbin/dtrace -qCs

typedef int afs_int32;

struct rx_debugIn {
    afs_int32 type;
    afs_int32 index;
};

BEGIN
{
  start_timestamp = timestamp;
  start_walltimestamp = walltimestamp;

  @rx_storedata_total = sum(0);
  @rx_fetchdata_total = sum(0);
  @rx_createfile_total = sum(0);
  @rx_removefile_total = sum(0);
  @rx_makedir_total = sum(0);
  @rx_removedir_total = sum(0);
  @rx_rename_total = sum(0);
  @rx_lookup_total = sum(0);
  @rx_link_total = sum(0);
  @rx_symlink_total = sum(0);
  @rx_storestatus_total = sum(0);
}

pid$1:a.out:rxi_ReadPacket:entry
{
  self->in = 1;

  self->inrxient_host = arg2;
  self->inrxient_port = arg3;
}

pid$1:a.out:rxi_ReadPacket:return
/ self->in /
{
  this->srcp = *(uintptr_t *)copyin(self->inrxient_host, sizeof(int));
  this->port = htons(*(uintptr_t *)copyin(self->inrxient_port,
sizeof(ushort)));

  this->srca = (this->srcp & 0xff000000) >> 24;
  this->srcb = (this->srcp & 0x00ff0000) >> 16;
  this->srcc = (this->srcp & 0x0000ff00) >> 8;
  this->srcd = (this->srcp & 0x000000ff);

  /* stringify addresses */
  self->src = strjoin(lltostr(this->srcd), ".");
  self->src = strjoin(self->src, strjoin(lltostr(this->srcc), "."));
  self->src = strjoin(self->src, strjoin(lltostr(this->srcb), "."));
  self->src = strjoin(self->src, lltostr(this->srca + 0));

  @rxi_RP_conn[self->src] = count();
  @rxi_RP_conn_ps[self->src] = count();
  rxi_RP_conn_total++;

  self->inrxient_host = 0;
  self->inrxient_port = 0;
  self->in = 0;

  self->inrx = 1;
}



/* RX CALLS */

pid$1:a.out:SRXAFS_CreateFile:entry
/ self->inrx /
{
  @rx_createfile[self->src] = count();
  @rx_createfile_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_RemoveFile:entry
/ self->inrx /
{
  @rx_removefile[self->src] = count();
  @rx_removefile_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_MakeDir:entry
/ self->inrx /
{
  @rx_makedir[self->src] = count();
  @rx_makedir_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_RemoveDir:entry
/ self->inrx /
{
  @rx_removedir[self->src] = count();
  @rx_removedir_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_Rename:entry
/ self->inrx /
{
  @rx_rename[self->src] = count();
  @rx_rename_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_Lookup:entry
/ self->inrx /
{
  @rx_lookup[self->src] = count();
  @rx_lookup_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_Link:entry
/ self->inrx /
{
  @rx_link[self->src] = count();
  @rx_link_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_Symlink:entry
/ self->inrx /
{
  @rx_symlink[self->src] = count();
  @rx_symlink_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:SRXAFS_StoreStatus:entry
/ self->inrx /
{
  @rx_storestatus[self->src] = count();
  @rx_storestatus_total = sum(1);
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:StoreData_RXStyle:entry
/ self->inrx /
{
  self->storedata = 1;

  self->inrx = 0;
}

pid$1:a.out:StoreData_RXStyle:return
/ self->storedata /
{
  self->storedata = 0;
  self->src = 0;
}

syscall::writev:return
/ self->storedata /
{
  @rx_storedata[self->src] = sum(arg0);
  @rx_storedata_total = sum(arg0);
}


pid$1:a.out:FetchData_RXStyle:entry
/ self->inrx /
{
  self->fetchdata = 1;

  self->inrx = 0;
}

pid$1:a.out:FetchData_RXStyle:return
/ self->fetchdata /
{
  self->fetchdata = 0;
  self->src = 0;

}

syscall::readv:return
/ self->fetchdata /
{
  @rx_fetchdata[self->src] = sum(arg0);
  @rx_fetchdata_total = sum(arg0);
}


pid$1:a.out:RXAFSCB_ProbeUuid:entry
/ self->inrx /
{
  printf("%Y %s from %s\n", walltimestamp, probefunc, self->src);;
  self->inrx = 0;
  self->src = 0;
}

pid$1:a.out:RXAFSCB_ProbeUuid:return
/ self->inrx /
{
  printf("%Y %s from %s\n", walltimestamp, probefunc, self->src);;
  self->inrx = 0;
  self->src = 0;
}


tick-$2
{
  this->seconds = (timestamp - start_timestamp) / 1000000000;
  normalize(@rxi_RP_conn_ps, this->seconds);
  normalize(@rx_fetchdata, 1024*1024);
  normalize(@rx_storedata, 1024*1024);
  normalize(@rx_fetchdata_total, 1024*1024);
  normalize(@rx_storedata_total, 1024*1024);
  setopt("aggsortrev", "true");
  printf("\033[H\033[J");
  printf("CLIENT IP         CONN CONN/s MKFILE RMFILE  MKDIR  RMDIR RENAME
LOOKUP   LINK SYMLNK SSTORE DFETCH DSTORE\n");
  printf("=============== ====== ====== ====== ====== ====== ====== ======
====== ====== ====== ====== ====== ======\n");
  printa("%-15s %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d
%@6d\n", @rxi_RP_conn, @rxi_RP_conn_ps, \
         @rx_createfile, @rx_removefile, @rx_makedir, @rx_removedir,
@rx_rename, @rx_lookup, @rx_link, @rx_symlink, \
         @rx_storestatus, @rx_fetchdata, @rx_storedata);
  printf("                ====== ====== ====== ====== ====== ====== ======
====== ====== ====== ====== ====== ======\n");
  printf("%-15s %6d %6d ", "", rxi_RP_conn_total,
rxi_RP_conn_total/this->seconds);
  printa("%@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d %@6d ",
@rx_createfile_total, @rx_removefile_total, @rx_makedir_total, \
         @rx_removedir_total, @rx_rename_total, @rx_lookup_total,
@rx_link_total, @rx_symlink_total, @rx_storestatus_total);
  printa("%@6d %@6d\n", @rx_fetchdata_total, @rx_storedata_total);

  printf("\n\n");
  printf("   started: %Y\n", start_walltimestamp);
  printf("   current: %Y\n", walltimestamp);

  printf("\n\n");
  printf("      SSTORE = Store Status\n");
  printf("      DSTORE = Stored Data in MB\n");
  printf("      DFETCH = Fetched Data in MB\n");
}


--
Robert Milkowski
Morgan Stanley | Enterprise Infrastructure
25 Cabot Square | Canary Wharf | Floor 02 London, E14 4QA
Phone: +44 20 7425-7065
[email protected]
<mailto:[email protected]> 


----------------------------------------------------------------------------
----

NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions
or views contained herein are not intended to be, and do not constitute,
advice within the meaning of Section 975 of the Dodd-Frank Wall Street
Reform and Consumer Protection Act. If you have received this communication
in error, please destroy all electronic and paper copies and notify the
sender immediately. Mistransmission is not intended to waive confidentiality
or privilege. Morgan Stanley reserves the right, to the extent permitted
under applicable law, to monitor electronic communications. This message is
subject to terms available at the following link:
http://www.morganstanley.com/disclaimers. If you cannot access these links,
please notify us by reply message and we will send the contents to you. By
messaging with Morgan Stanley you consent to the foregoing.

_______________________________________________
OpenAFS-info mailing list
[email protected]
https://lists.openafs.org/mailman/listinfo/openafs-info

Reply via email to