[Title] added memory log
authorgiwoong.kim <giwoong.kim@samsung.com>
Fri, 20 Apr 2012 07:59:27 +0000 (16:59 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Fri, 20 Apr 2012 07:59:27 +0000 (16:59 +0900)
[Type] enhancement
[Module] Emulator
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

tizen/src/emulator.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index cadfdac..d322a4b
 #include <glib/gstdio.h>
 
 #if defined( _WIN32)
-//#include <winsock2.h>
+#include <windows.h>
 #elif defined(__linux__)
 #include <linux/version.h>
 #include <sys/utsname.h>
+#include <sys/sysinfo.h>
 #endif
 
 #include "mloop_event.h"
@@ -234,6 +235,8 @@ void extract_info(int qemu_argc, char** qemu_argv)
 
 static void system_info(void)
 {
+#define DIV 1024
+
 #ifdef __linux__
     char lscmd[MAXLEN] = "lspci >> ";
 #endif
@@ -277,6 +280,12 @@ static void system_info(void)
     GetSystemInfo(&sysi);
     INFO("* Processor type : %d, Number of processors : %d\n", sysi.dwProcessorType,  sysi.dwNumberOfProcessors);
 
+    MEMORYSTATUSEX memInfo;
+    memInfo.dwLength = sizeof(MEMORYSTATUSEX);
+    GlobalMemoryStatusEx(&memInfo);
+    INFO("* Total Ram : %llu kB, Free: %lld kB\n",
+        memInfo.ullTotalPhys / DIV, memInfo.ullAvailPhys / DIV);
+
 #elif defined(__linux__)
     /* depends on building */
     INFO("* Qemu build machine linux kernel version : (%d, %d, %d)\n",
@@ -289,6 +298,13 @@ static void system_info(void)
             host_uname_buf.release, host_uname_buf.version, host_uname_buf.machine);
     }
 
+    struct sysinfo sys_info;
+    if (sysinfo(&sys_info) == 0) {
+        INFO("* Total Ram : %llu kB, Free: %llu kB\n",
+            sys_info.totalram * (unsigned long long)sys_info.mem_unit / DIV,
+            sys_info.freeram * (unsigned long long)sys_info.mem_unit / DIV);
+    }
+
     /* pci device description */
     INFO("* Pci devices :\n");
     strcat(lscmd, logpath);