1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-22 04:17:44 +00:00

Make small improvement: print packets per second in topmode.

Original patch from:		Gleb Smirnoff <glebius@cell.sick.ru>
Fixed patch from, approved by:	Dmitry Morozovsky <marck@rinet.ru> (maintainer)
This commit is contained in:
Sergey A. Osokin 2004-06-23 12:01:33 +00:00
parent d8f20aab80
commit 79c3a398f4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=112043
4 changed files with 85 additions and 8 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= ehnt
PORTVERSION= 0.3
PORTREVISION= 6
PORTREVISION= 7
CATEGORIES= net-mgmt
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}

View File

@ -2,8 +2,16 @@
$FreeBSD$
--- ehnt.h.orig Thu Oct 4 22:18:29 2001
+++ ehnt.h Thu May 20 16:07:24 2004
@@ -93,7 +93,7 @@
+++ ehnt.h Wed Jun 23 14:35:08 2004
@@ -59,6 +59,7 @@
struct ehnt_stats {
double InBoundTotal, OutBoundTotal;
+ double InBoundTotalPkts, OutBoundTotalPkts;
double *InBoundSrcAS, *InBoundDstAS, *OutBoundSrcAS, *OutBoundDstAS;
double *InBoundProto, *OutBoundProto;
double *InBoundSrcTcpPort, *InBoundDstTcpPort,
@@ -93,7 +94,7 @@
int ProcessFlow(struct flow_ver5_rec *, struct in_addr *, struct ehnt_struct *);
int Init_ASN_Lookups(void);
char * ASN_Lookup(int);

View File

@ -2,8 +2,43 @@
$FreeBSD$
--- ehnt_display.c.orig Thu Oct 4 22:18:29 2001
+++ ehnt_display.c Thu May 20 16:06:07 2004
@@ -246,7 +246,7 @@
+++ ehnt_display.c Wed Jun 23 14:35:08 2004
@@ -110,7 +110,9 @@
ShowReportTimeHeader(stats);
if ( ! report_inout ) {
- printf (" Total %10.0fkbits/s\n",stats->InBoundTotal*8/((interval)*1024));
+ printf (" Total %10.0fkbits/s, %10.0fkpps\n",
+ stats->InBoundTotal*8/((interval)*1024),
+ stats->InBoundTotalPkts/((interval)*1024));
if ( e_cfg->topmode != ETM_PROTO ) {
printf ("Rank|-------------Source----------------| |---------------Dest----------------|\n");
}
@@ -151,8 +153,9 @@
printf ("Rank|-------------Source----------------| |---------------Dest----------------|\n");
}
printf("%s",header);
- printf (" O U T B O U N D (total %.0fkbits/s)\n",
- stats->OutBoundTotal*8/((interval)*1024));
+ printf (" O U T B O U N D (total %.0fkbits/s, %.0fkpps)\n",
+ stats->OutBoundTotal*8/((interval)*1024),
+ stats->OutBoundTotalPkts/((interval)*1024));
for (i=1; i<= (int)(e_cfg->screenlength - headersize)/2 + 1; i++) {
printf("%2d:",i);
@@ -183,8 +186,9 @@
}
printf("\n");
}
- printf (" I N B O U N D (total %.0fkbits/s)\n",
- stats->InBoundTotal*8/((interval)*1000));
+ printf (" I N B O U N D (total %.0fkbits/s, %.0fkpps)\n",
+ stats->InBoundTotal*8/((interval)*1024),
+ stats->InBoundTotalPkts/((interval)*1024));
for (i=1; i<= (int)(e_cfg->screenlength - headersize)/2; i++) {
printf("%2d:",i);
switch (e_cfg->topmode) {
@@ -246,7 +250,7 @@
static char str[100];

View File

@ -2,8 +2,33 @@
$FreeBSD$
--- ehnt_processflow.c.orig Thu Oct 4 22:18:29 2001
+++ ehnt_processflow.c Fri May 21 11:22:02 2004
@@ -218,7 +218,7 @@
+++ ehnt_processflow.c Wed Jun 23 14:35:08 2004
@@ -81,6 +81,8 @@
/* copy current stats to old stats */
old_stats->InBoundTotal=stats->InBoundTotal;
old_stats->OutBoundTotal=stats->OutBoundTotal;
+ old_stats->InBoundTotalPkts=stats->InBoundTotalPkts;
+ old_stats->OutBoundTotalPkts=stats->OutBoundTotalPkts;
old_stats->InBoundSrcAS=stats->InBoundSrcAS;
old_stats->InBoundDstAS=stats->InBoundDstAS;
@@ -126,6 +128,7 @@
if (e_flt->intnum) {
if (rec->output_index == e_flt->intnum) {
stats->OutBoundTotal+=rec->dOctets;
+ stats->OutBoundTotalPkts+=rec->dPkts;
stats->OutBoundSrcAS[rec->src_as]+=rec->dOctets;
stats->OutBoundDstAS[rec->dst_as]+=rec->dOctets;
stats->OutBoundProto[rec->prot]+=rec->dOctets;
@@ -142,6 +145,7 @@
we just put everthing in the InBound tables: */
if ( (! e_flt->intnum) || (rec->input_index == e_flt->intnum) ) {
stats->InBoundTotal+=rec->dOctets;
+ stats->InBoundTotalPkts+=rec->dPkts;
stats->InBoundSrcAS[rec->src_as]+=rec->dOctets;
stats->InBoundDstAS[rec->dst_as]+=rec->dOctets;
stats->InBoundProto[rec->prot]+=rec->dOctets;
@@ -218,7 +222,7 @@
dstip.s_addr=rec->dstaddr;
nexthop.s_addr=rec->nexthop;
@ -12,7 +37,7 @@ $FreeBSD$
printf("%d:%s:%d:",
rec->input_index,
inet_ntoa(srcip),
@@ -228,7 +228,7 @@
@@ -228,7 +232,7 @@
inet_ntoa(dstip),
rec->dstport);
@ -21,3 +46,12 @@ $FreeBSD$
printf("%d:%d\n",rec->src_as,rec->dst_as);
if (e_flt->big) {
@@ -289,6 +293,8 @@
stats->InBoundTotal=0;
stats->OutBoundTotal=0;
+ stats->InBoundTotalPkts=0;
+ stats->OutBoundTotalPkts=0;
}
int FreeStats (struct ehnt_stats *stats) {