tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: [patch] bug fix & TCP networking performance improvements
dyoung%pobox.com@localhost said:
> On Fri, Apr 22, 2011 at 01:40:35PM +0200, Matthias Drochner wrote:
> > Btw, I think that it would be better to use microuptime(9)
> > rather than microtime(9) for these interval things, to make
> > it robust against time changes. Or getmicrouptime(9) to save
> > some cycles - accuracy shouldn't be an issue.
> Definitely.
Here is something which works.
OK, the use of kvm in netstat sucks. But it sucks already that
kvm is needed just to see whether a socket is still in TIME_WAIT,
so it doesn't make it much worse.
best regards
Matthias
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDirig Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Besuchen Sie uns auf unserem neuen Webauftritt unter www.fz-juelich.de
#
# old_revision [a51a48ee150b7f3dcbd731011a84ab7036eb6660]
#
# patch "sys/netinet/tcp_vtw.c"
# from [986f64095d75b135d46e7a3409dd0ebd815fd668]
# to [af56912fd7edc0d6e1a19edd8355ec9435bce2bd]
#
# patch "usr.bin/netstat/inet.c"
# from [7f83c653dd6f33930953d8a5549a241878813868]
# to [409727f972e78bee871bd967edb277871600b0d8]
#
# patch "usr.bin/netstat/vtw.c"
# from [88c049da7050cb1fa565e1e497579df2b27cf4c8]
# to [0aef6cc1a705c70e55080fbc57763f8c11ceec6f]
#
# patch "usr.bin/netstat/vtw.h"
# from [46e5d34e2f0fd392813c23a08a88cfe450c01d44]
# to [1a09de2e927ccbf7977a02b2e3925cd0d7a605e1]
#
============================================================
--- sys/netinet/tcp_vtw.c 986f64095d75b135d46e7a3409dd0ebd815fd668
+++ sys/netinet/tcp_vtw.c af56912fd7edc0d6e1a19edd8355ec9435bce2bd
@@ -1430,7 +1430,7 @@ vtw_alloc(vtw_ctl_t *ctl)
/* mark expiration
*/
- microtime(&vtw->expire);
+ getmicrouptime(&vtw->expire);
/* Move expiration into the future.
*/
@@ -1516,7 +1516,7 @@ vtw_tick(void *arg)
struct timeval now;
int i, cnt = 0;
- microtime(&now);
+ getmicrouptime(&now);
db_trace(KTR_VTW, (arg, "vtk: tick - now %8.8x:%8.8x"
, now.tv_sec, now.tv_usec));
============================================================
--- usr.bin/netstat/inet.c 7f83c653dd6f33930953d8a5549a241878813868
+++ usr.bin/netstat/inet.c 409727f972e78bee871bd967edb277871600b0d8
@@ -343,7 +343,10 @@ end:
}
end:
if (istcp) {
+ struct timeval t;
+ timebase(&t);
gettimeofday(&now, NULL);
+ timersub(&now, &t, &now);
show_vtw_v4(print_vtw_v4);
}
}
============================================================
--- usr.bin/netstat/vtw.c 88c049da7050cb1fa565e1e497579df2b27cf4c8
+++ usr.bin/netstat/vtw.c 0aef6cc1a705c70e55080fbc57763f8c11ceec6f
@@ -167,6 +167,19 @@ lookup(const char *name)
return NULL;
}
+void
+timebase(struct timeval *tv)
+{
+ void *p;
+ struct bintime timebasebin;
+
+ p = lookup("timebasebin");
+ if (!p)
+ return;
+ snarf(p, &timebasebin, sizeof(timebasebin));
+ bintime2timeval(&timebasebin, tv);
+}
+
static void
process_vtw(const vtw_ctl_t * ctl, void (*print)(const vtw_t *))
{
============================================================
--- usr.bin/netstat/vtw.h 46e5d34e2f0fd392813c23a08a88cfe450c01d44
+++ usr.bin/netstat/vtw.h 1a09de2e927ccbf7977a02b2e3925cd0d7a605e1
@@ -4,5 +4,6 @@ void show_vtw_v6(void (*)(const vtw_t *)
void show_vtw_stats(void);
void show_vtw_v4(void (*)(const vtw_t *));
void show_vtw_v6(void (*)(const vtw_t *));
+void timebase(struct timeval *);
#endif /* _NETSTAT_VTW_H */
Home |
Main Index |
Thread Index |
Old Index