Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
4342d191f9153fc753f23d6ae3ebaf8076104953
[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 mmstats(void *md)
20 {
21   struct mstats result;
22   struct mdesc *mdp;
23
24   mdp = MD_TO_MDP(md);
25   result.bytes_total = (char *) mdp->top - (char *) mdp;
26   result.chunks_used = mdp->heapstats.chunks_used;
27   result.bytes_used = mdp->heapstats.bytes_used;
28   result.chunks_free = mdp->heapstats.chunks_free;
29   result.bytes_free = mdp->heapstats.bytes_free;
30   return (result);
31 }