Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics (kill unused var, and kill/improve debug outputs)
[simgrid.git] / src / xbt / 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 /* Copyright (c) 2010. The SimGrid Team.
8  * All rights reserved.                                                     */
9
10 /* This program is free software; you can redistribute it and/or modify it
11  * under the terms of the license (GNU LGPL) which comes with this package. */
12
13 #include "mmprivate.h"
14
15 /* FIXME:  See the comment in mmprivate.h where struct mstats is defined.
16    None of the internal mmalloc structures should be externally visible
17    outside the library. */
18
19 struct mstats
20 mmstats (void *md)
21 {
22   struct mstats result;
23   struct mdesc *mdp;
24
25   mdp = MD_TO_MDP (md);
26   result.bytes_total =
27       (char*) mdp -> top - (char*)mdp;
28   result.chunks_used = mdp -> heapstats.chunks_used;
29   result.bytes_used = mdp -> heapstats.bytes_used;
30   result.chunks_free = mdp -> heapstats.chunks_free;
31   result.bytes_free = mdp -> heapstats.bytes_free;
32   return (result);
33 }