NAMD
Public Member Functions | Friends | List of all members
memusageinit Class Reference

#include <memusage.h>

Public Member Functions

 memusageinit ()
 

Friends

unsigned long memusage (const char **source)
 

Detailed Description

Definition at line 15 of file memusage.h.

Constructor & Destructor Documentation

memusageinit::memusageinit ( )

Definition at line 22 of file memusage.C.

22  {
23  if ( initialized == 0 ) {
24  sbrkval = (unsigned long) sbrk(0);
25  initialized = 1;
26  }
27 }

Friends And Related Function Documentation

unsigned long memusage ( const char **  source)
friend

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 158 of file memusage.C.

158  {
159 
160  unsigned long memtotal = 0;
161  const char* s = "ERROR";
162 
163  if ( ! CmiMemoryIs(CMI_MEMORY_IS_OS) ) {
164  memtotal = CmiMemoryUsage(); s = "CmiMemoryUsage";
165  }
166 
167 #if CMK_BLUEGENEQ
168  if( ! memtotal) { memtotal = memusage_bgq(); s="Kernel_GetMemorySize on BG/Q"; }
169 #endif
170 
171 #if CMK_BLUEGENEP
172  if( ! memtotal) { memtotal = memusage_bgp(); s="mallinfo on BG/P"; }
173 #endif
174 
175 #if defined(WIN32) && !defined(__CYGWIN__)
176  if ( ! memtotal ) {
177  memtotal = CmiMemoryUsage(); s = "GetProcessMemoryInfo";
178  }
179 #endif
180 
181  if ( ! memtotal ) {
182  memtotal = memusage_proc_self_stat(); s = "/proc/self/stat";
183  }
184 
185  if ( ! memtotal ) { memtotal = memusage_mstats(); s = "mstats"; }
186 
187  if ( ! memtotal ) { memtotal = memusage_mallinfo(); s = "mallinfo"; }
188 
189  if ( ! memtotal ) { memtotal = memusageinit::memusage_sbrk(); s = "sbrk"; }
190 
191  if ( ! memtotal ) { memtotal = memusage_ps(); s = "ps"; }
192 
193  if ( ! memtotal ) { memtotal = CmiMemoryUsage(); s = "CmiMemoryUsage"; }
194 
195  if ( ! memtotal ) s = "nothing";
196 
197  if ( source ) *source = s;
198 
199  return memtotal;
200 
201 }
unsigned long memusage_mallinfo()
Definition: memusage.C:68
unsigned long memusage_ps()
Definition: memusage.C:86
unsigned long memusage_proc_self_stat()
Definition: memusage.C:131
unsigned long memusage_mstats()
Definition: memusage.C:60

The documentation for this class was generated from the following files: