Index: net/bpf.c =================================================================== RCS file: /home/ncvs/src/sys/net/bpf.c,v retrieving revision 1.185 diff -u -r1.185 bpf.c --- net/bpf.c 25 Dec 2007 13:24:02 -0000 1.185 +++ net/bpf.c 6 Feb 2008 14:06:03 -0000 @@ -132,6 +132,9 @@ static int bpf_maxinsns = BPF_MAXINSNS; SYSCTL_INT(_net_bpf, OID_AUTO, maxinsns, CTLFLAG_RW, &bpf_maxinsns, 0, "Maximum bpf program instructions"); +static int bpf_fastts = 0; +SYSCTL_INT(_net_bpf, OID_AUTO, fastts, CTLFLAG_RW, + &bpf_fastts, 0, "Use fast, innacurate timestamps based on ticks"); SYSCTL_NODE(_net_bpf, OID_AUTO, stats, CTLFLAG_RW, bpf_stats_sysctl, "bpf statistics portal"); @@ -1268,6 +1271,19 @@ return (ready); } +static void +bpf_gettime(struct timeval *tv) +{ + if (!bpf_fastts) { + microtime(tv); + return; + } + /* just generate a timestamp based on ticks */ + tv->tv_sec = ticks / tick + boottime.tv_sec; + tv->tv_usec = ticks % tick + boottime.tv_usec; + +} + /* * Incoming linkage from device drivers. Process the packet pkt, of length * pktlen, which is stored in a contiguous buffer. The packet is parsed @@ -1296,7 +1312,7 @@ if (slen != 0) { d->bd_fcount++; if (!gottime) { - microtime(&tv); + bpf_gettime(&tv); gottime = 1; } #ifdef MAC @@ -1375,7 +1391,7 @@ if (slen != 0) { d->bd_fcount++; if (!gottime) { - microtime(&tv); + bpf_gettime(&tv); gottime = 1; } #ifdef MAC @@ -1430,7 +1446,7 @@ if (slen != 0) { d->bd_fcount++; if (!gottime) { - microtime(&tv); + bpf_gettime(&tv); gottime = 1; } #ifdef MAC