summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2015-05-25 18:14:12 +0200
committerAndreas Baumann <abaumann@yahoo.com>2015-05-25 18:14:12 +0200
commit48ad3d9ece36f8f0404b431ebaf75557bb721ac8 (patch)
treecdb1ffb33c049a8204f0b1868b940d767201c9a6
parent66079abd1083a00f165b8fc62eec885f872b903c (diff)
downloadbiruda-48ad3d9ece36f8f0404b431ebaf75557bb721ac8.tar.gz
biruda-48ad3d9ece36f8f0404b431ebaf75557bb721ac8.tar.bz2
added system_phys_memory (implemented on Windows)
-rw-r--r--src/biruda.c2
-rw-r--r--src/system.c13
-rw-r--r--src/system.h3
3 files changed, 18 insertions, 0 deletions
diff --git a/src/biruda.c b/src/biruda.c
index e150627..ea1fce5 100644
--- a/src/biruda.c
+++ b/src/biruda.c
@@ -204,6 +204,8 @@ static void print_config( struct gengetopt_args_info *args_info, cfg_t *cfg )
unsigned int nofCpus = system_available_cpus( );
puts( "Environment:" );
printf( " Number of CPUs: %d\n", nofCpus );
+ int physMem = system_phys_memory( );
+ printf( " Physical memory available: %d MB\n", physMem );
char machine_arch[100];
system_arch( machine_arch, sizeof( machine_arch ) );
printf( " System architecture: %s\n", machine_arch );
diff --git a/src/system.c b/src/system.c
index fede36c..b947ce2 100644
--- a/src/system.c
+++ b/src/system.c
@@ -382,3 +382,16 @@ void system_arch( char *name, size_t len )
snprintf( name, len, "%s", uts.machine );
#endif
}
+
+int system_phys_memory( )
+{
+#ifdef _WIN32
+ MEMORYSTATUSEX memState;
+ memset( &memState, 0, sizeof( MEMORYSTATUSEX ) );
+ memState.dwLength = sizeof( MEMORYSTATUSEX );
+ GlobalMemoryStatusEx( &memState );
+ return memState.ullTotalPhys / 1024 / 1024;
+#else
+#endif
+}
+
diff --git a/src/system.h b/src/system.h
index 196b676..1b84c5a 100644
--- a/src/system.h
+++ b/src/system.h
@@ -9,4 +9,7 @@ void system_os( char *name, size_t len );
void system_arch( char *name, size_t len );
+/* in kilobytes */
+int system_phys_memory( );
+
#endif