[Groonga-commit] groonga/groonga [master] output mlocked info in header. #737:

Back to archive index

null+****@clear***** null+****@clear*****
2010年 12月 15日 (水) 20:02:04 JST


brazil	2010-12-15 11:02:04 +0000 (Wed, 15 Dec 2010)

  New Revision: d07ad3a8e3082df16a969e0afb66dc939541cb76

  Log:
    output mlocked info in header. #737:

  Modified files:
    src/grntest.c

  Modified: src/grntest.c (+18 -1)
===================================================================
--- src/grntest.c    2010-12-15 10:40:22 +0000 (60e3e36)
+++ src/grntest.c    2010-12-15 11:02:04 +0000 (90cda59)
@@ -1379,6 +1379,8 @@ get_sysinfo(const char *path, char *result, int olen)
   int ret;
   int cpunum = 0;
   int minfo = 0;
+  int unevictable = 0;
+  int mlocked = 0;
   char cpustring[256];
   struct utsname ubuf;
   struct statvfs vfsbuf;
@@ -1456,14 +1458,29 @@ get_sysinfo(const char *path, char *result, int olen)
     if (!strncmp(tmpbuf, "MemTotal:", 9)) {
       minfo = grntest_atoi(&tmpbuf[10], &tmpbuf[10] + 40, NULL);
     }
+    if (!strncmp(tmpbuf, "Unevictable:", 12)) {
+      unevictable = grntest_atoi(&tmpbuf[13], &tmpbuf[13] + 40, NULL);
+    }
+    if (!strncmp(tmpbuf, "Mlocked:", 8)) {
+      mlocked = grntest_atoi(&tmpbuf[9], &tmpbuf[9] + 40, NULL);
+    }
   }
   fclose(fp);
   if (grntest_outtype == OUT_TSV) {
     sprintf(tmpbuf, "%dMBytes\n", minfo/1024);
+    strcat(result, tmpbuf);
+    sprintf(tmpbuf, "%dMBytes_Unevictable\n", unevictable/1024);
+    strcat(result, tmpbuf);
+    sprintf(tmpbuf, "%dMBytes_Mlocked\n", mlocked/1024);
+    strcat(result, tmpbuf);
   } else {
     sprintf(tmpbuf, "  \"RAM\": \"%dMBytes\",\n", minfo/1024);
+    strcat(result, tmpbuf);
+    sprintf(tmpbuf, "  \"Unevictable\": \"%dMBytes\",\n", unevictable/1024);
+    strcat(result, tmpbuf);
+    sprintf(tmpbuf, "  \"Mlocked\": \"%dMBytes\",\n", mlocked/1024);
+    strcat(result, tmpbuf);
   }
-  strcat(result, tmpbuf);
 
   ret = statvfs(path, &vfsbuf);
   if (ret) {




Groonga-commit メーリングリストの案内
Back to archive index