xref: /netbsd-src/external/gpl2/libmalloc/dist/mstats.c (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /*	$NetBSD: mstats.c,v 1.1.1.1 2016/01/13 21:42:18 christos Exp $	*/
2 
3 /* Access the statistics maintained by `malloc'.
4    Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
5 		  Written May 1989 by Mike Haertel.
6 
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
11 
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 Library General Public License for more details.
16 
17 You should have received a copy of the GNU Library General Public
18 License along with this library; see the file COPYING.LIB.  If
19 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
20 Cambridge, MA 02139, USA.
21 
22    The author may be reached (Email) at the address mike@ai.mit.edu,
23    or (US mail) as Mike Haertel c/o Free Software Foundation.  */
24 
25 #ifndef	_MALLOC_INTERNAL
26 #define _MALLOC_INTERNAL
27 #include <malloc.h>
28 #endif
29 
30 struct mstats
31 mstats ()
32 {
33   struct mstats result;
34 
35   result.bytes_total = (char *) (*__morecore) (0) - _heapbase;
36   result.chunks_used = _chunks_used;
37   result.bytes_used = _bytes_used;
38   result.chunks_free = _chunks_free;
39   result.bytes_free = _bytes_free;
40   return result;
41 }
42