File: memstat.c

package info (click to toggle)
espresso 6.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 311,040 kB
  • sloc: f90: 447,429; ansic: 52,566; sh: 40,631; xml: 37,561; tcl: 20,077; lisp: 5,923; makefile: 4,502; python: 4,379; perl: 1,219; cpp: 761; fortran: 618; java: 568; awk: 128
file content (37 lines) | stat: -rw-r--r-- 814 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
  Copyright (C) 2002 FPMD group
  This file is distributed under the terms of the
  GNU General Public License. See the file `License'
  in the root directory of the present distribution,
  or http://www.gnu.org/copyleft/gpl.txt .
*/

/* 
  This function returns the number of kilobytes
  allocated by the calling process. 
  Author: Carlo Cavazzoni.
  Obsolete AIX case and F77-C binding removed by P. Giannozzi (2017)
*/

#if !defined(QE_NO_CONFIG_H)
#include "qe_cdefs.h"
#endif

#if defined (__SVR4) && defined (__sun)
#define SUN_MALLINFO
#endif

#if defined(HAVE_MALLINFO) && !defined(__QK_USER__) && !defined(SUN__MALLINFO) 

#include <malloc.h>
int c_memstat( )
{
  struct mallinfo info;  
  info = mallinfo();
  return (info.arena + info.hblkhd) / 1024 ;
#else
int c_memstat( )
{
  return -1;
#endif
}