merge from gcc
[deliverable/binutils-gdb.git] / mmalloc / mmstats.c
1 /* Access the statistics maintained by `mmalloc'.
2 Copyright 1990, 1991, 1992 Free Software Foundation
3
4 Written May 1989 by Mike Haertel.
5 Modified Mar 1992 by Fred Fish. (fnf@cygnus.com)
6
7 The GNU C 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 The GNU C 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 the GNU C Library; see the file COPYING.LIB. If
19 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, 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 #include "mmprivate.h"
26
27 /* FIXME: See the comment in mmprivate.h where struct mstats is defined.
28 None of the internal mmalloc structures should be externally visible
29 outside the library. */
30
31 struct mstats
32 mmstats (md)
33 PTR md;
34 {
35 struct mstats result;
36 struct mdesc *mdp;
37
38 mdp = MD_TO_MDP (md);
39 result.bytes_total =
40 (char *) mdp -> morecore (mdp, 0) - mdp -> heapbase;
41 result.chunks_used = mdp -> heapstats.chunks_used;
42 result.bytes_used = mdp -> heapstats.bytes_used;
43 result.chunks_free = mdp -> heapstats.chunks_free;
44 result.bytes_free = mdp -> heapstats.bytes_free;
45 return (result);
46 }
This page took 0.043009 seconds and 4 git commands to generate.