|
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", |