As suggested on wireshark-users, when using io,stat in tshark, make an

interval of 0 signify "all packets".


svn path=/trunk/; revision=27715
This commit is contained in:
Sake Blok 2009-03-12 22:44:58 +00:00
parent cafdbc05f4
commit cf23f50e1a
2 changed files with 21 additions and 7 deletions

View File

@ -539,6 +539,7 @@ B<-z> io,stat,I<interval>[,I<filter>][,I<filter>][,I<filter>]...
Collect packet/bytes statistics for the capture in intervals of
I<interval> seconds. I<Intervals> can be specified either as whole or
fractional seconds. Interval can be specified in ms resolution.
If Interval is 0, the statistics will be calculated over all packets.
If no I<filter> is specified the statistics will be calculated for all packets.
If one or more I<filters> are specified statistics will be calculated for

View File

@ -284,7 +284,8 @@ iostat_draw(void *arg)
printf("\n");
printf("===================================================================\n");
printf("IO Statistics\n");
printf("Interval: %d.%03d secs\n", iot->interval/1000, iot->interval%1000);
if(iot->interval!=G_MAXINT32)
printf("Interval: %d.%03d secs\n", iot->interval/1000, iot->interval%1000);
for(i=0;i<iot->num_items;i++){
printf("Column #%d: %s\n",i,iot->filters[i]?iot->filters[i]:"");
}
@ -353,9 +354,14 @@ iostat_draw(void *arg)
}
if(more_items){
printf("%03d.%03d-%03d.%03d ",
t/1000,t%1000,
(t+iot->interval)/1000,(t+iot->interval)%1000);
if(iot->interval==G_MAXINT32) {
printf("000.000- ");
} else {
printf("%03d.%03d-%03d.%03d ",
t/1000,t%1000,
(t+iot->interval)/1000,
(t+iot->interval)%1000);
}
for(i=0;i<iot->num_items;i++){
switch(iot->items[i].calc_type){
case CALC_TYPE_BYTES:
@ -625,11 +631,18 @@ iostat_init(const char *optarg, void* userdata _U_)
exit(1);
}
/* if interval is 0, calculate statistics over the whole file
* by setting the interval to G_MAXINT32
*/
if(interval_float==0) {
interval=G_MAXINT32;
} else {
/* make interval be number of ms */
interval=(gint32)(interval_float*1000.0+0.9);
}
/* make interval be number of ms */
interval=(gint32)(interval_float*1000.0+0.9);
if(interval<1){
fprintf(stderr, "tshark: \"-z\" interval must be >=0.001 seconds.\n");
fprintf(stderr, "tshark: \"-z\" interval must be >=0.001 seconds or 0.\n");
exit(10);
}