#!/usr/sbin/dtrace -s /* * isns_client_stat.d - Report iSNS stat counters for the client operations. * * This traces the timings for iSNS server response for register, deregister * andquery. * The output reports the receive/send time for each message. * * USAGE: isns_client_stat.d # Hit Ctrl-C to end * * FIELDS: * CLIENT IP address of the client * PROBENAME * OPERATION operatioin name * TIME nsecs for operation duration. * * AGGREGATION Total number of operations. * duration time distributioin. */ #pragma ident "@(#)isns_client_stat.d 1.1 07/08/20 SMI" #pragma D option quiet #pragma D option dynvarsize=64m self string client; self int t; self string op; dtrace:::BEGIN { printf("Tracing... Hit Ctrl-C to end.\n"); } isns*:::connection-accepted { self->t = timestamp; self->client = copyinstr(args[0]); printf("%s : client %s \n", probename, self->client); } isns*:::msg-received { self->t = timestamp; self->client = copyinstr(args[0]); printf("\t%s : client %s \n", probename, self->client); @counts[self->client] = count(); } isns*:::msg-responded /self->t != 0 && self->op != NULL/ { self->client = copyinstr(args[0]); @avgtime[self->client,self->op] = quantize(timestamp - self->t); printf("\t%s : client %s(spent %d nsecs)\n", probename, self->client, timestamp - self->t); self->t = 0; self->op = NULL; } isns*:::operation-type /self->t != 0/ { operation[1ul] = "Device Attribute Registration"; operation[2ul] = "Device Attribute Query"; operation[3ul] = "Device Get Next"; operation[4ul] = "Device Attribute Deregistration"; operation[5ul] = "SCN Registration"; operation[6ul] = "SCN Deregistration"; operation[7ul] = "SCN Event"; operation[8ul] = "SCN Deregistration"; operation[9ul] = "SCN Deregistration"; operation[10ul] = "DD Registration"; operation[11ul] = "DD Deregistration"; operation[12ul] = "DD Set Registration"; operation[13ul] = "DD Set Deregistration"; operation[14ul] = "ESI"; operation[15ul] = "Heartbeat"; printf("\t\toperation: %s \n", operation[args[1]]); self->op = (string)operation[args[1]]; } dtrace:::END { end = timestamp; }