Add event counters that measure FAST_MBSEARCH.

This commit is contained in:
thorpej 2003-10-21 21:17:20 +00:00
parent 7d9835b758
commit 861856caa0
2 changed files with 27 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_output.c,v 1.101 2003/08/22 22:00:38 itojun Exp $ */
/* $NetBSD: tcp_output.c,v 1.102 2003/10/21 21:17:20 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -138,7 +138,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.101 2003/08/22 22:00:38 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.102 2003/10/21 21:17:20 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -442,15 +442,21 @@ tcp_build_datapkt(struct tcpcb *tp, struct socket *so, int off,
/*
* To avoid traversing the whole sb_mb chain for correct
* data to send, remember last sent mbuf, its offset and
* the sent size. When called the next time, see if the
* data to send is the directly following the previous
* transfer. This is important for large TCP windows.
* data to send, remember last sent mbuf, its offset and
* the sent size. When called the next time, see if the
* data to send is directly following the previous transfer.
* This is important for large TCP windows.
*/
if (
#ifdef FAST_MBSEARCH
if (off == 0 || (tp->t_lastoff + tp->t_lastlen) != off) {
off == 0 || (tp->t_lastoff + tp->t_lastlen) != off
#else
if (1) {
1
#endif
)
{
#ifdef FAST_MBSEARCH
TCP_OUTPUT_COUNTER_INCR(&tcp_output_predict_hit);
#endif
/*
* Either a new packet or a retransmit.
@ -458,8 +464,12 @@ tcp_build_datapkt(struct tcpcb *tp, struct socket *so, int off,
*/
tp->t_lastm = so->so_snd.sb_mb;
tp->t_inoff = off;
} else
} else {
#ifdef FAST_MBSEARCH
TCP_OUTPUT_COUNTER_INCR(&tcp_output_predict_miss);
#endif
tp->t_inoff += tp->t_lastlen;
}
/* Traverse forward to next packet */
while (tp->t_inoff > 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_subr.c,v 1.154 2003/09/25 00:59:31 mycroft Exp $ */
/* $NetBSD: tcp_subr.c,v 1.155 2003/10/21 21:17:20 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.154 2003/09/25 00:59:31 mycroft Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.155 2003/10/21 21:17:20 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -245,6 +245,10 @@ struct evcnt tcp_swcsum = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
struct evcnt tcp_output_bigheader = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
NULL, "tcp", "output big header");
struct evcnt tcp_output_predict_hit = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
NULL, "tcp", "output predict hit");
struct evcnt tcp_output_predict_miss = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
NULL, "tcp", "output predict miss");
struct evcnt tcp_output_copysmall = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
NULL, "tcp", "output copy small");
struct evcnt tcp_output_copybig = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
@ -343,6 +347,8 @@ tcp_init()
#ifdef TCP_OUTPUT_COUNTERS
evcnt_attach_static(&tcp_output_bigheader);
evcnt_attach_static(&tcp_output_predict_hit);
evcnt_attach_static(&tcp_output_predict_miss);
evcnt_attach_static(&tcp_output_copysmall);
evcnt_attach_static(&tcp_output_copybig);
evcnt_attach_static(&tcp_output_refbig);