]> Zhao Yanbai Git Server - minix.git/commitdiff
VM: report resource usage with VM usage info 43/3243/2
authorDavid van Moolenbroek <david@minix3.org>
Wed, 4 Nov 2015 11:10:57 +0000 (11:10 +0000)
committerLionel Sambuc <lionel.sambuc@gmail.com>
Wed, 13 Jan 2016 19:32:41 +0000 (20:32 +0100)
Change-Id: I93e898343e7fb72e75ae74c650b10f2ba570d381

minix/include/minix/vm.h
minix/servers/vm/region.c

index 149efd1f05188a165eebb49d66140d60fd5ab1f1..c8af1b3f815b01c993887adf78d266e1347b88a4 100644 (file)
@@ -54,6 +54,9 @@ struct vm_usage_info {
   vir_bytes vui_shared;                /* shared (non-COW) part of common memory */
   vir_bytes vui_virtual;       /* total size of virtual address space */
   vir_bytes vui_mvirtual;      /* idem but minus unmapped stack pages */
+  uint64_t vui_maxrss;         /* maximum resident set size (in KB) */
+  uint64_t vui_minflt;         /* minor page faults */
+  uint64_t vui_majflt;         /* major page faults */
 };
 
 struct vm_region_info {
index fed1e97f401f788092911ebad1ba687c0bedeebe..e13c0afb9c2eaf8d71516a47e985c5c408f87ffa 100644 (file)
@@ -1436,6 +1436,14 @@ void get_usage_info(struct vmproc *vmp, struct vm_usage_info *vui)
                }
                region_incr_iter(&v_iter);
        }
+
+       /*
+        * Also include getrusage resource information, so that the MIB service
+        * need not make more than one call to VM for each process entry.
+        */
+       vui->vui_maxrss = vmp->vm_total_max / 1024L;
+       vui->vui_minflt = vmp->vm_minor_page_fault;
+       vui->vui_majflt = vmp->vm_major_page_fault;
 }
 
 /*===========================================================================*