MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mbpr

Function mbpr

tools/netstat/mbuf.c:75–374  ·  view source on GitHub ↗

* Print mbuf statistics. */

Source from the content-addressed store, hash-verified

73 * Print mbuf statistics.
74 */
75void
76mbpr(void *kvmd, u_long mbaddr)
77{
78 struct memory_type_list *mtlp;
79 struct memory_type *mtp;
80 uintmax_t mbuf_count, mbuf_bytes, mbuf_free, mbuf_failures, mbuf_size;
81 uintmax_t mbuf_sleeps;
82 uintmax_t cluster_count, cluster_limit, cluster_free;
83 uintmax_t cluster_failures, cluster_size, cluster_sleeps;
84 uintmax_t packet_count, packet_bytes, packet_free, packet_failures;
85 uintmax_t packet_sleeps;
86 uintmax_t tag_bytes;
87 uintmax_t jumbop_count, jumbop_limit, jumbop_free;
88 uintmax_t jumbop_failures, jumbop_sleeps, jumbop_size;
89 uintmax_t jumbo9_count, jumbo9_limit, jumbo9_free;
90 uintmax_t jumbo9_failures, jumbo9_sleeps, jumbo9_size;
91 uintmax_t jumbo16_count, jumbo16_limit, jumbo16_free;
92 uintmax_t jumbo16_failures, jumbo16_sleeps, jumbo16_size;
93 uintmax_t bytes_inuse, bytes_incache, bytes_total;
94 int nsfbufs, nsfbufspeak, nsfbufsused;
95 struct sfstat sfstat;
96 size_t mlen;
97#ifndef FSTACK
98 int error;
99#endif
100
101 mtlp = memstat_mtl_alloc();
102 if (mtlp == NULL) {
103 xo_warn("memstat_mtl_alloc");
104 return;
105 }
106
107 /*
108 * Use memstat_*_all() because some mbuf-related memory is in uma(9),
109 * and some malloc(9).
110 */
111 if (live) {
112 if (memstat_sysctl_all(mtlp, 0) < 0) {
113 xo_warnx("memstat_sysctl_all: %s",
114 memstat_strerror(memstat_mtl_geterror(mtlp)));
115 goto out;
116 }
117 } else {
118#ifndef FSTACK
119 if (memstat_kvm_all(mtlp, kvmd) < 0) {
120 error = memstat_mtl_geterror(mtlp);
121 if (error == MEMSTAT_ERROR_KVM)
122 xo_warnx("memstat_kvm_all: %s",
123 kvm_geterr(kvmd));
124 else
125 xo_warnx("memstat_kvm_all: %s",
126 memstat_strerror(error));
127 goto out;
128 }
129#endif
130 }
131
132 mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_MEM_NAME);

Callers 1

main.cFile · 0.85

Calls 15

memstat_mtl_allocFunction · 0.85
xo_warnFunction · 0.85
memstat_sysctl_allFunction · 0.85
xo_warnxFunction · 0.85
memstat_strerrorFunction · 0.85
memstat_mtl_geterrorFunction · 0.85
memstat_kvm_allFunction · 0.85
memstat_mtl_findFunction · 0.85
memstat_get_countFunction · 0.85
memstat_get_bytesFunction · 0.85
memstat_get_freeFunction · 0.85
memstat_get_failuresFunction · 0.85

Tested by

no test coverage detected