Service Response Time measurements and statistics for Fibre Channel

svn path=/trunk/; revision=7932
This commit is contained in:
Ronnie Sahlberg 2003-06-25 11:15:34 +00:00
parent 59433c81b7
commit 2c95c28f0e
5 changed files with 305 additions and 11 deletions

View File

@ -344,6 +344,25 @@ on those calls that match that filter.
Example: use B<-z "smb,srt,ip.addr==1.2.3.4"> to only collect stats for
SMB packets echanged by the host at IP address 1.2.3.4 .
B<-z> fc,srt[,I<filter>]
Collect call/reply SRT (Service Response Time) data for FC. Data collected
is number of calls for each Fibre Channel command, MinSRT, MaxSRT and AvgSRT.
Example: use B<-z fc,srt>.
The Service Response Time is calculated as the time delta between the
First frame of the exchange and the Last frame of the exchange.
The data will be presented as separate tables for all normal FC commands,
Only those commands that are seen in the capture will have its stats
displayed.
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 "fc,srt,fc.id==01.02.03"> to only collect stats for
FC packets echanged by the host at FC address 01.02.03 .
B<-z> mgcp,rtd[I<,filter>]
Collect requests/response RTD (Response Time Delay) data for MGCP.
@ -638,6 +657,22 @@ If an optional filter string is used only such DCE-RPC request/response pairs
that match that filter will be used to calculate the statistics. If no filter
string is specified all request/response pairs will be used.
=item Tools:Statistics:Service Response Time:Fibre Channel
Open a window to display Service Response Time statistics for Fibre Channel
and display B<FC Type>, B<Number of Calls>, B<Minimum SRT>,
B<Maximum SRT> and B<Average SRT> for all FC types.
These windows opened will update in semi-real time to
reflect changes when doing live captures or when reading new capture
files into B<Ethereal>.
The Service Response Time is calculated as the time delta between the
First frame of the exchange and the Last frame of the exchange.
This dialog will also allow an optional filter string to be used.
If an optional filter string is used only such FC first/last exchange pairs
that match that filter will be used to calculate the statistics. If no filter
string is specified all request/response pairs will be used.
=item Tools:Statistics:Service Response Time:ONC-RPC
Open a window to display statistics for an arbitrary ONC-RPC program interface

View File

@ -1,7 +1,7 @@
# Makefile.am
# Automake file for the GTK interface routines for Ethereal
#
# $Id: Makefile.am,v 1.60 2003/06/21 01:42:45 sahlberg Exp $
# $Id: Makefile.am,v 1.61 2003/06/25 11:15:34 sahlberg Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com>
@ -29,6 +29,7 @@ CLEANFILES = \
ETHEREAL_TAP_SRC = \
dcerpc_stat.c \
fc_stat.c \
io_stat.c \
mgcp_stat.c \
rpc_stat.c \

View File

@ -1,7 +1,7 @@
## Makefile for building ethereal.exe with Microsoft C and nmake
## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
#
# $Id: Makefile.nmake,v 1.45 2003/06/21 01:42:45 sahlberg Exp $
# $Id: Makefile.nmake,v 1.46 2003/06/25 11:15:34 sahlberg Exp $
include ..\config.nmake
@ -21,6 +21,7 @@ CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
ETHEREAL_TAP_SRC = \
dcerpc_stat.c \
fc_stat.c \
io_stat.c \
mgcp_stat.c \
rpc_stat.c \

258
gtk/fc_stat.c Normal file
View File

@ -0,0 +1,258 @@
/* fc_stat.c
* fc_stat 2003 Ronnie Sahlberg
*
* $Id: fc_stat.c,v 1.1 2003/06/25 11:15:34 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "menu.h"
#include "../epan/packet_info.h"
#include "../tap.h"
#include "../epan/value_string.h"
#include "../packet-fc.h"
#include "../register.h"
#include "../timestats.h"
#include "compat_macros.h"
#include "../simple_dialog.h"
#include "../file.h"
#include "../globals.h"
#include "service_response_time_table.h"
/* used to keep track of the statistics for an entire program interface */
typedef struct _fcstat_t {
GtkWidget *win;
srt_stat_table fc_srt_table;
} fcstat_t;
static void
fcstat_reset(void *pfc)
{
fcstat_t *fc=(fcstat_t *)pfc;
reset_srt_table_data(&fc->fc_srt_table);
}
static int
fcstat_packet(void *pfc, packet_info *pinfo, epan_dissect_t *edt _U_, void *psi)
{
fc_hdr *fc=(fc_hdr *)psi;
fcstat_t *fs=(fcstat_t *)pfc;
/* we are only interested in reply packets */
if(!(fc->fctl&FC_FCTL_EXCHANGE_RESPONDER)){
return 0;
}
/* if we havnt seen the request, just ignore it */
if( (!fc->fced) || (fc->fced->first_exchange_frame==0) ){
return 0;
}
add_srt_table_data(&fs->fc_srt_table, fc->type, &fc->fced->fc_time, pinfo);
return 1;
}
static void
fcstat_draw(void *pfc)
{
fcstat_t *fc=(fcstat_t *)pfc;
draw_srt_table_data(&fc->fc_srt_table);
}
void protect_thread_critical_region(void);
void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
fcstat_t *fc=(fcstat_t *)data;
protect_thread_critical_region();
remove_tap_listener(fc);
unprotect_thread_critical_region();
free_srt_table_data(&fc->fc_srt_table);
g_free(fc);
}
static void
gtk_fcstat_init(char *optarg)
{
fcstat_t *fc;
char *filter=NULL;
GtkWidget *label;
char filter_string[256];
GString *error_string;
int i;
GtkWidget *vbox;
if(!strncmp(optarg,"fc,srt,",7)){
filter=optarg+7;
} else {
filter=NULL;
}
fc=g_malloc(sizeof(fcstat_t));
fc->win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(fc->win), 550, 400);
gtk_window_set_title(GTK_WINDOW(fc->win), "Fibre Channel Service Response Time statistics");
SIGNAL_CONNECT(fc->win, "destroy", win_destroy_cb, fc);
vbox=gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(fc->win), vbox);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
gtk_widget_show(vbox);
label=gtk_label_new("Fibre Channel Service Response Time statistics");
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_widget_show(label);
snprintf(filter_string,255,"Filter:%s",filter?filter:"");
label=gtk_label_new(filter_string);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_widget_show(label);
label=gtk_label_new("Fibre Channel Types");
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_widget_show(label);
/* We must display TOP LEVEL Widget before calling init_srt_table() */
gtk_widget_show(fc->win);
init_srt_table(&fc->fc_srt_table, 256, vbox);
for(i=0;i<256;i++){
init_srt_table_row(&fc->fc_srt_table, i, val_to_str(i, fc_fc4_val, "Unknown(0x%02x)"));
}
error_string=register_tap_listener("fc", fc, filter, fcstat_reset, fcstat_packet, fcstat_draw);
if(error_string){
simple_dialog(ESD_TYPE_WARN, NULL, error_string->str);
g_string_free(error_string, TRUE);
g_free(fc);
return;
}
gtk_widget_show_all(fc->win);
redissect_packets(&cfile);
}
static GtkWidget *dlg=NULL, *dlg_box;
static GtkWidget *filter_box;
static GtkWidget *filter_label, *filter_entry;
static GtkWidget *start_button;
static void
dlg_destroy_cb(void)
{
dlg=NULL;
}
static void
fcstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
{
char *filter;
char str[256];
filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry));
if(filter[0]==0){
gtk_fcstat_init("fc,srt");
} else {
sprintf(str,"fc,srt,%s", filter);
gtk_fcstat_init(str);
}
}
static void
gtk_fcstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
/* if the window is already open, bring it to front */
if(dlg){
gdk_window_raise(dlg->window);
return;
}
dlg=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(dlg), "Fibre Channel Service Response Time statistics");
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
dlg_box=gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
gtk_widget_show(dlg_box);
/* filter box */
filter_box=gtk_hbox_new(FALSE, 10);
/* Filter label */
gtk_container_set_border_width(GTK_CONTAINER(filter_box), 10);
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
filter_entry=gtk_entry_new_with_max_length(250);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, FALSE, FALSE, 0);
gtk_widget_show(filter_entry);
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
fcstat_start_button_clicked, NULL);
gtk_box_pack_start(GTK_BOX(dlg_box), start_button, TRUE, TRUE, 0);
gtk_widget_show(start_button);
gtk_widget_show_all(dlg);
}
void
register_tap_listener_gtkfcstat(void)
{
register_ethereal_tap("fc,srt", gtk_fcstat_init);
}
void
register_tap_menu_gtkfcstat(void)
{
register_tap_menu_item("Service Response Time/Fibre Channel", gtk_fcstat_cb);
}

View File

@ -4,7 +4,7 @@
* Copyright 2003 Ronnie Sahlberg, exchange first/last matching and
* tap listener and misc updates
*
* $Id: packet-fc.c,v 1.10 2003/06/25 10:21:44 sahlberg Exp $
* $Id: packet-fc.c,v 1.11 2003/06/25 11:15:33 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -688,7 +688,7 @@ dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint8 ftype;
gboolean is_ack;
fc_hdr fchdr;
static fc_hdr fchdr;
fc_exchange_data *fc_ex=NULL;
fchdr.fced=NULL;
@ -749,6 +749,7 @@ dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(fchdr.fctl&FC_FCTL_EXCHANGE_FIRST){
if(!pinfo->fd->flags.visited){
fc_exchange_data fced, *old_fced;
/* first check if we already have seen this exchange and it
is still open/unmatched.
*/
@ -763,19 +764,18 @@ dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
old_fced->oxid=fchdr.oxid;
old_fced->s_id=fchdr.s_id;
old_fced->d_id=fchdr.d_id;
old_fced->first_exchange_frame=pinfo->fd->num;
old_fced->first_exchange_frame=pinfo->fd->num;
old_fced->fc_time.nsecs = pinfo->fd->abs_usecs*1000;
old_fced->fc_time.secs = pinfo->fd->abs_secs;
g_hash_table_insert(fc_exchange_unmatched, old_fced, old_fced);
fc_ex=old_fced;
} else {
fc_exchange_data fced, *old_fced;
fced.oxid=fchdr.oxid;
fced.first_exchange_frame=pinfo->fd->num;
fced.last_exchange_frame=0;
old_fced=g_hash_table_lookup(fc_exchange_matched, &fced);
if(old_fced){
fc_ex=old_fced;
}
fc_ex=old_fced;
}
}
if(fchdr.fctl&FC_FCTL_EXCHANGE_LAST){
@ -791,15 +791,14 @@ old_fced->first_exchange_frame=pinfo->fd->num;
old_fced->last_exchange_frame=pinfo->fd->num;
g_hash_table_insert(fc_exchange_matched, old_fced, old_fced);
}
fc_ex=old_fced;
} else {
fc_exchange_data fced, *old_fced;
fced.oxid=fchdr.oxid;
fced.first_exchange_frame=0;
fced.last_exchange_frame=pinfo->fd->num;
old_fced=g_hash_table_lookup(fc_exchange_matched, &fced);
if(old_fced){
fc_ex=old_fced;
}
fc_ex=old_fced;
}
}
if(fc_ex){