[OpenAFS] rx_clients.d

Robert Milkowski rmilkowski@task.gda.pl
Thu, 25 Oct 2012 23:51:25 +0100


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:
=20
# ./rx_clients.d `pgrep fileserver` 5s

CLIENT IP=A0=A0=A0=A0=A0=A0=A0=A0 CONN CONN/s MKFILE RMFILE=A0 MKDIR=A0 =
RMDIR RENAME LOOKUP=A0=A0
LINK SYMLNK SSTORE DSTORE=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =
=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =
=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =
=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =
=3D=3D=3D=3D=3D=3D
172.24.40.236=A0=A0=A0=A0 6009=A0=A0=A0 133=A0=A0=A0 234=A0=A0=A0 =
702=A0=A0=A0 234=A0=A0=A0 234=A0=A0=A0=A0=A0 0=A0=A0=A0=A0=A0 0=A0=A0=A0
234=A0=A0=A0 235=A0=A0=A0 235=A0=A0=A0=A0=A0 0
172.24.3.188=A0=A0=A0=A0=A0=A0 178=A0=A0=A0=A0=A0 3=A0=A0=A0=A0=A0 =
0=A0=A0=A0=A0=A0 1=A0=A0=A0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 238=A0=A0=A0=A0=A0 0
=A0

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

=A0=A0=A0=A0=A0=A0=A0 SSTORE =3D Store Status
=A0=A0=A0=A0=A0=A0=A0 DSTORE =3D 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 =3D timestamp;
  start_walltimestamp =3D walltimestamp;

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

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

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

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

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

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

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

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

  self->inrx =3D 1;
}



/* RX CALLS */

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

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

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

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

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

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

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

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

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

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

  self->inrx =3D 0;
}

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

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


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

  self->inrx =3D 0;
}

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

}

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


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

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


tick-$2
{
  this->seconds =3D (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("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =
=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =
=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =
=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =
=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D\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("                =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =
=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =
=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =
=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D\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 =3D Store Status\n");
  printf("      DSTORE =3D Stored Data in MB\n");
  printf("      DFETCH =3D 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
Robert.Milkowski@morganstanley.com
<mailto:Robert.Milkowski@morganstanley.com>=20


-------------------------------------------------------------------------=
---
----

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.