View | Details | Raw Unified | Return to bug 19809
Collapse All | Expand All

(-)sys/kern/uipc_mbuf.c (+1 lines)
Lines 184-189 Link Here
184
		p += MSIZE;
184
		p += MSIZE;
185
	}
185
	}
186
	mbstat.m_mbufs += nmb;
186
	mbstat.m_mbufs += nmb;
187
	mbstat.m_mtypes[MT_FREE] += nmb;
187
	return (1);
188
	return (1);
188
}
189
}
189
190
(-)sys/sys/mbuf.h (-1 / +1 lines)
Lines 191-197 Link Here
191
	u_long	m_drops;	/* times failed to find space */
191
	u_long	m_drops;	/* times failed to find space */
192
	u_long	m_wait;		/* times waited for space */
192
	u_long	m_wait;		/* times waited for space */
193
	u_long	m_drain;	/* times drained protocols for space */
193
	u_long	m_drain;	/* times drained protocols for space */
194
	u_short	m_mtypes[256];	/* type specific mbuf allocations */
194
	u_long	m_mtypes[32];	/* type specific mbuf allocations */
195
	u_long	m_mcfail;	/* times m_copym failed */
195
	u_long	m_mcfail;	/* times m_copym failed */
196
	u_long	m_mpfail;	/* times m_pullup failed */
196
	u_long	m_mpfail;	/* times m_pullup failed */
197
	u_long	m_msize;	/* length of an mbuf */
197
	u_long	m_msize;	/* length of an mbuf */
(-)usr.bin/netstat/mbuf.c (-10 / +5 lines)
Lines 91-98 Link Here
91
	{ 0, 0 }
91
	{ 0, 0 }
92
};
92
};
93
93
94
int nmbtypes = sizeof(mbstat.m_mtypes) / sizeof(short);
94
#define NMBTYPES (sizeof(mbstat.m_mtypes) / sizeof(mbstat.m_mtypes[0]))
95
bool seen[256];			/* "have we seen this type yet?" */
95
bool seen[NMBTYPES];		/* "have we seen this type yet?" */
96
96
97
/*
97
/*
98
 * Print mbuf statistics.
98
 * Print mbuf statistics.
Lines 133-143 Link Here
133
#undef MCLBYTES
133
#undef MCLBYTES
134
#define	MCLBYTES	(mbstat.m_mclbytes)
134
#define	MCLBYTES	(mbstat.m_mclbytes)
135
135
136
	if (nmbtypes != 256) {
137
		warnx("unexpected change to mbstat; check source");
138
		return;
139
	}
140
141
	totmbufs = 0;
136
	totmbufs = 0;
142
	for (mp = mbtypes; mp->mt_name; mp++)
137
	for (mp = mbtypes; mp->mt_name; mp++)
143
		totmbufs += mbstat.m_mtypes[mp->mt_type];
138
		totmbufs += mbstat.m_mtypes[mp->mt_type];
Lines 146-158 Link Here
146
	for (mp = mbtypes; mp->mt_name; mp++)
141
	for (mp = mbtypes; mp->mt_name; mp++)
147
		if (mbstat.m_mtypes[mp->mt_type]) {
142
		if (mbstat.m_mtypes[mp->mt_type]) {
148
			seen[mp->mt_type] = YES;
143
			seen[mp->mt_type] = YES;
149
			printf("\t%u mbufs allocated to %s\n",
144
			printf("\t%lu mbufs allocated to %s\n",
150
			    mbstat.m_mtypes[mp->mt_type], mp->mt_name);
145
			    mbstat.m_mtypes[mp->mt_type], mp->mt_name);
151
		}
146
		}
152
	seen[MT_FREE] = YES;
147
	seen[MT_FREE] = YES;
153
	for (i = 0; i < nmbtypes; i++)
148
	for (i = 0; i < NMBTYPES; i++)
154
		if (!seen[i] && mbstat.m_mtypes[i]) {
149
		if (!seen[i] && mbstat.m_mtypes[i]) {
155
			printf("\t%u mbufs allocated to <mbuf type %d>\n",
150
			printf("\t%lu mbufs allocated to <mbuf type %d>\n",
156
			    mbstat.m_mtypes[i], i);
151
			    mbstat.m_mtypes[i], i);
157
		}
152
		}
158
	printf("%lu/%lu/%u mbuf clusters in use (current/peak/max)\n",
153
	printf("%lu/%lu/%u mbuf clusters in use (current/peak/max)\n",

Return to bug 19809