aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/tethereal.pod.template8
-rw-r--r--tap-rpcstat.c19
-rw-r--r--tap-rpcstat.h4
-rw-r--r--tethereal.c13
4 files changed, 25 insertions, 19 deletions
diff --git a/doc/tethereal.pod.template b/doc/tethereal.pod.template
index 1d0b924dff..5f58f409d1 100644
--- a/doc/tethereal.pod.template
+++ b/doc/tethereal.pod.template
@@ -309,13 +309,19 @@ Get B<Tethereal> to collect various types of statistics and display the result
after finishing reading the capture file.
Currently implemented statistics are:
-B<-z> rpc,rtt,I<program>,I<version>
+B<-z> rpc,rtt,I<program>,I<version>[,I<filter>]
Collect call/reply RTT data for I<program>/I<version>. Data collected
is number of calls for each procedure, MinRTT, MaxRTT and AvgRTT.
Example: use B<-z rpc,rtt,100003,3> to collect data for NFS v3. This
option can be used multiple times on the command line.
+If the optional filterstring is provided, the stats will only be calculated
+on those calls that match that filter.
+Example: use B<-z rpc,rtt,100003,3,nfs.fh.hash==0x12345678> to collect NFS v3
+RTT statistics for a specific file.
+
+
B<-z> rpc,programs
Collect call/reply RTT data for all known ONC-RPC programs/versions.
diff --git a/tap-rpcstat.c b/tap-rpcstat.c
index cf80ef73e7..fd54089f29 100644
--- a/tap-rpcstat.c
+++ b/tap-rpcstat.c
@@ -1,7 +1,7 @@
/* tap-rpcstat.c
* rpcstat 2002 Ronnie Sahlberg
*
- * $Id: tap-rpcstat.c,v 1.1 2002/09/04 09:40:24 sahlberg Exp $
+ * $Id: tap-rpcstat.c,v 1.2 2002/09/26 01:13:02 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -273,12 +273,10 @@ rpcstat_find_procs(gpointer *key, gpointer *value _U_, gpointer *user_data _U_)
* new instance for the rpc tap.
*/
void
-rpcstat_init(guint32 program, guint32 version)
+rpcstat_init(guint32 program, guint32 version, char *filter)
{
rpcstat_t *rs;
guint32 i;
-/* char filter[256];*/
-
rs=g_malloc(sizeof(rpcstat_t));
rs->prog=rpc_prog_name(program);
@@ -313,17 +311,14 @@ rpcstat_init(guint32 program, guint32 version)
/* It is possible to create a filter and attach it to the callbacks. Then the
* callbacks would only be invoked if the filter matched.
* Evaluating filters is expensive and if we can avoid it and not use them
- * we gain performance. Here we just tap everything from rpc without
- * filtering and we do the filtering we need explicitely inside the callback
- * itself (*packet) instead with a few if()s.
+ * we gain performance.
+ * In this case we do the filtering for protocol and version inside the
+ * callback itself but use whatever filter the user provided.
+ * (Perhaps the user only want the stats for nis+ traffic for certain objects?)
*
- * This is what it would look like IF we wanted to use a filter when attaching
- * it to the tap.
- snprintf(filter, 255, "(rpc.msgtyp==1) && (rpc.program==%d) && (rpc.programversion==%d)",program,version);
- register_tap_listener("rpc", rs, filter, (void*)rpcstat_reset, (void*)rpcstat_packet, (void*)rpcstat_draw);
*/
- if(register_tap_listener("rpc", rs, NULL, (void*)rpcstat_reset, (void*)rpcstat_packet, (void*)rpcstat_draw)){
+ if(register_tap_listener("rpc", rs, filter, (void*)rpcstat_reset, (void*)rpcstat_packet, (void*)rpcstat_draw)){
/* error, we failed to attach to the tap. clean up */
g_free(rs->procedures);
g_free(rs);
diff --git a/tap-rpcstat.h b/tap-rpcstat.h
index 28463ef6f2..114ad33b19 100644
--- a/tap-rpcstat.h
+++ b/tap-rpcstat.h
@@ -1,7 +1,7 @@
/* tap-rpcstat.h
* rpcstat 2002 Ronnie Sahlberg
*
- * $Id: tap-rpcstat.h,v 1.1 2002/09/04 09:40:24 sahlberg Exp $
+ * $Id: tap-rpcstat.h,v 1.2 2002/09/26 01:13:02 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -22,7 +22,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-void rpcstat_init(guint32 program, guint32 version);
+void rpcstat_init(guint32 program, guint32 version, char *filter);
diff --git a/tethereal.c b/tethereal.c
index bfcb03e14c..4e64b96344 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,6 +1,6 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.157 2002/09/06 22:45:40 sahlberg Exp $
+ * $Id: tethereal.c,v 1.158 2002/09/26 01:13:02 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -634,10 +634,15 @@ main(int argc, char *argv[])
if(!strncmp(optarg,"rpc,",4)){
if(!strncmp(optarg,"rpc,rtt,",8)){
int rpcprogram, rpcversion;
- if(sscanf(optarg,"rpc,rtt,%d,%d",&rpcprogram,&rpcversion)==2){
- rpcstat_init(rpcprogram,rpcversion);
+ int pos=0;
+ if(sscanf(optarg,"rpc,rtt,%d,%d,%n",&rpcprogram,&rpcversion,&pos)==2){
+ if(pos){
+ rpcstat_init(rpcprogram,rpcversion,optarg+pos);
+ } else {
+ rpcstat_init(rpcprogram,rpcversion,NULL);
+ }
} else {
- fprintf(stderr, "tethereal: invalid \"-z rpc,rtt,<program>,<version>\" argument\n");
+ fprintf(stderr, "tethereal: invalid \"-z rpc,rtt,<program>,<version>[,<filterstring>]\" argument\n");
exit(1);
}
} else if(!strncmp(optarg,"rpc,programs",12)){