Browse Source

Enable function GetProcessMemoryInfo() to get reliable memory usage data

for MINGW and MSVC console, WinGui and MSVC shared ngspice.
MINGW shared ngspice does not link to psapi.dll, so cannot
apply  GetProcessMemoryInfo(),  but sticks to unreliable function
GlobalMemoryStatusEx().
pre-master-46
Holger Vogt 7 years ago
parent
commit
cf6722af17
  1. 9
      src/Makefile.am
  2. 3
      src/frontend/resource.c

9
src/Makefile.am

@ -334,6 +334,15 @@ if WINGUI
LIBS += -lpsapi
endif
if WINCONSOLE
LIBS += -lpsapi
endif
## FIXME: Should be allwed, but fails within MSYS2
#if SHWIN
#LIBS += -lpsapi
#endif
CLEANFILES = ngspice.idx spinit tclspinit pkgIndex.tcl
MAINTAINERCLEANFILES = Makefile.in

3
src/frontend/resource.c

@ -479,7 +479,8 @@ fprintmem(FILE *stream, unsigned long long memory) {
static int get_procm(struct proc_mem *memall) {
#if defined(_MSC_VER) || defined(__MINGW32__)
#if (_WIN32_WINNT >= 0x0500) && defined(HAS_WINGUI)
/* FIXME: shared module should be allowed, but currently does not link to psapi within MINGW/MSYS2 */
#if (_WIN32_WINNT >= 0x0500) && (!defined(SHARED_MODULE) || _MSC_VER)
/* Use Windows API function to obtain size of memory - more accurate */
HANDLE hProcess;
PROCESS_MEMORY_COUNTERS pmc;

Loading…
Cancel
Save