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

Function _memstat_mt_reset_stats

tools/libmemstat/memstat.c:184–215  ·  view source on GitHub ↗

* Reset any libmemstat(3)-owned statistics in a memory_type record so that * it can be reused without incremental addition problems. Caller-owned * memory is left "as-is", and must be updated by the caller if desired. * * libmemstat(3) internal function. */

Source from the content-addressed store, hash-verified

182 * libmemstat(3) internal function.
183 */
184void
185_memstat_mt_reset_stats(struct memory_type *mtp, int maxcpus)
186{
187 int i;
188
189 mtp->mt_countlimit = 0;
190 mtp->mt_byteslimit = 0;
191 mtp->mt_sizemask = 0;
192 mtp->mt_size = 0;
193
194 mtp->mt_memalloced = 0;
195 mtp->mt_memfreed = 0;
196 mtp->mt_numallocs = 0;
197 mtp->mt_numfrees = 0;
198 mtp->mt_bytes = 0;
199 mtp->mt_count = 0;
200 mtp->mt_free = 0;
201 mtp->mt_failures = 0;
202 mtp->mt_sleeps = 0;
203
204 mtp->mt_zonefree = 0;
205 mtp->mt_kegfree = 0;
206
207 for (i = 0; i < maxcpus; i++) {
208 mtp->mt_percpu_alloc[i].mtp_memalloced = 0;
209 mtp->mt_percpu_alloc[i].mtp_memfreed = 0;
210 mtp->mt_percpu_alloc[i].mtp_numallocs = 0;
211 mtp->mt_percpu_alloc[i].mtp_numfrees = 0;
212 mtp->mt_percpu_alloc[i].mtp_sizemask = 0;
213 mtp->mt_percpu_cache[i].mtp_free = 0;
214 }
215}
216
217/*
218 * Accessor methods for struct memory_type. Avoids encoding the structure

Callers 4

memstat_sysctl_umaFunction · 0.85
memstat_kvm_umaFunction · 0.85
memstat_sysctl_mallocFunction · 0.85
memstat_kvm_mallocFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected