1147997Srwatson/*-
2147997Srwatson * Copyright (c) 2005 Robert N. M. Watson
3147997Srwatson * All rights reserved.
4147997Srwatson *
5147997Srwatson * Redistribution and use in source and binary forms, with or without
6147997Srwatson * modification, are permitted provided that the following conditions
7147997Srwatson * are met:
8147997Srwatson * 1. Redistributions of source code must retain the above copyright
9147997Srwatson *    notice, this list of conditions and the following disclaimer.
10147997Srwatson * 2. Redistributions in binary form must reproduce the above copyright
11147997Srwatson *    notice, this list of conditions and the following disclaimer in the
12147997Srwatson *    documentation and/or other materials provided with the distribution.
13147997Srwatson *
14147997Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15147997Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16147997Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17147997Srwatson * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18147997Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19147997Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20147997Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21147997Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22147997Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23147997Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24147997Srwatson * SUCH DAMAGE.
25147997Srwatson *
26147997Srwatson * $FreeBSD$
27147997Srwatson */
28147997Srwatson
29147997Srwatson#include <sys/types.h>
30147997Srwatson#include <sys/queue.h>
31147997Srwatson
32147997Srwatson#include "memstat.h"
33147997Srwatson
34147997Srwatson/*
35147997Srwatson * Query all available memory allocator sources.  Currently this consists of
36147997Srwatson * malloc(9) and UMA(9).
37147997Srwatson */
38147997Srwatsonint
39147997Srwatsonmemstat_sysctl_all(struct memory_type_list *mtlp, int flags)
40147997Srwatson{
41147997Srwatson
42147997Srwatson	if (memstat_sysctl_malloc(mtlp, flags) < 0)
43147997Srwatson		return (-1);
44147997Srwatson	if (memstat_sysctl_uma(mtlp, flags) < 0)
45147997Srwatson		return (-1);
46147997Srwatson	return (0);
47147997Srwatson}
48148627Srwatson
49148627Srwatsonint
50148627Srwatsonmemstat_kvm_all(struct memory_type_list *mtlp, void *kvm_handle)
51148627Srwatson{
52148627Srwatson
53148627Srwatson	if (memstat_kvm_malloc(mtlp, kvm_handle) < 0)
54148627Srwatson		return (-1);
55148627Srwatson	if (memstat_kvm_uma(mtlp, kvm_handle) < 0)
56148627Srwatson		return (-1);
57148627Srwatson	return (0);
58148627Srwatson}
59