add protection metrics of zoneinfo

"Wu, Liming" <[email protected]> Thu, 26 Jan 2017 07:49:26 +0000
Newsgroups gmane.comp.sysutils.pcp
Message-ID <[email protected]>
Hi:
   
   These 2 patch add protection metrics of zoneinfoto linux pmda. 
   And add the protection's regression test.
   please refer to the attachment for the details.


Thanks,

--
Liming Wu
--



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#15035): https://groups.io/g/pcp/message/15035
View All Messages In Topic (1): https://groups.io/g/pcp/topic/4253203
Mute This Topic: https://groups.io/mt/4253203?uid=174580
New Topic: https://groups.io/g/pcp/post
-=-=-
pcp mailing list
[email protected]
https://groups.io/g/pcp/messages
-=-=-
Change Your Subscription: https://groups.io/g/pcp/editsub?uid=174580
Group Home: https://groups.io/g/pcp
Contact Group Owner: [email protected]
Terms of Service: https://groups.io/static/tos
Unsubscribe: https://groups.io/g/pcp/leave/354243/563757577/xyzzy
-=-=-=-=-=-=-=-=-=-=-=-
Addition-of-zoneinfo-regression-testing.patch (application/octet-stream, 4.1 KB)
From 9c89c3b4a14e2207be368c001c29dbfa566b1e82 Mon Sep 17 00:00:00 2001
From: Liming <[email protected]>
Date: Thu, 26 Jan 2017 15:40:26 +0800
Subject: [PATCH] Addition of zoneinfo regression testing

for protection was added, add the corresponding regression.
---
 qa/821.out | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)

diff --git a/qa/821.out b/qa/821.out
index 38a76f2..0b03420 100644
--- a/qa/821.out
+++ b/qa/821.out
@@ -746,6 +746,26 @@ mem.zoneinfo.present
     inst [N or "DMA::node0"] value 15984
     inst [N or "Normal::node0"] value 14653440
 
+mem.zoneinfo.protection1
+    inst [N or "DMA32::node0"] value 0
+    inst [N or "DMA::node0"] value 0
+    inst [N or "Normal::node0"] value 0
+
+mem.zoneinfo.protection2
+    inst [N or "DMA32::node0"] value 0
+    inst [N or "DMA::node0"] value 6336
+    inst [N or "Normal::node0"] value 0
+
+mem.zoneinfo.protection3
+    inst [N or "DMA32::node0"] value 56164
+    inst [N or "DMA::node0"] value 62500
+    inst [N or "Normal::node0"] value 0
+
+mem.zoneinfo.protection4
+    inst [N or "DMA32::node0"] value 56164
+    inst [N or "DMA::node0"] value 62500
+    inst [N or "Normal::node0"] value 0
+
 mem.zoneinfo.scanned
     inst [N or "DMA32::node0"] value 0
     inst [N or "DMA::node0"] value 0
@@ -1837,6 +1857,26 @@ mem.zoneinfo.present
     inst [N or "DMA::node0"] value 15984
     inst [N or "Normal::node0"] value 14653440
 
+mem.zoneinfo.protection1
+    inst [N or "DMA32::node0"] value 0
+    inst [N or "DMA::node0"] value 0
+    inst [N or "Normal::node0"] value 0
+
+mem.zoneinfo.protection2
+    inst [N or "DMA32::node0"] value 0
+    inst [N or "DMA::node0"] value 6336
+    inst [N or "Normal::node0"] value 0
+
+mem.zoneinfo.protection3
+    inst [N or "DMA32::node0"] value 56164
+    inst [N or "DMA::node0"] value 62500
+    inst [N or "Normal::node0"] value 0
+
+mem.zoneinfo.protection4
+    inst [N or "DMA32::node0"] value 56164
+    inst [N or "DMA::node0"] value 62500
+    inst [N or "Normal::node0"] value 0
+
 mem.zoneinfo.scanned
     inst [N or "DMA32::node0"] value 0
     inst [N or "DMA::node0"] value 0
@@ -2572,6 +2612,30 @@ mem.zoneinfo.present
     inst [N or "Normal::node0"] value 65011712
     inst [N or "Normal::node1"] value 67108864
 
+mem.zoneinfo.protection1
+    inst [N or "DMA32::node0"] value 0
+    inst [N or "DMA::node0"] value 0
+    inst [N or "Normal::node0"] value 0
+    inst [N or "Normal::node1"] value 0
+
+mem.zoneinfo.protection2
+    inst [N or "DMA32::node0"] value 0
+    inst [N or "DMA::node0"] value 7016
+    inst [N or "Normal::node0"] value 0
+    inst [N or "Normal::node1"] value 0
+
+mem.zoneinfo.protection3
+    inst [N or "DMA32::node0"] value 249844
+    inst [N or "DMA::node0"] value 256864
+    inst [N or "Normal::node0"] value 0
+    inst [N or "Normal::node1"] value 0
+
+mem.zoneinfo.protection4
+    inst [N or "DMA32::node0"] value 249844
+    inst [N or "DMA::node0"] value 256864
+    inst [N or "Normal::node0"] value 0
+    inst [N or "Normal::node1"] value 0
+
 mem.zoneinfo.scanned
     inst [N or "DMA32::node0"] value 0
     inst [N or "DMA::node0"] value 0
@@ -3558,6 +3622,30 @@ mem.zoneinfo.present
     inst [N or "Normal::node0"] value 65011712
     inst [N or "Normal::node1"] value 67108864
 
+mem.zoneinfo.protection1
+    inst [N or "DMA32::node0"] value 0
+    inst [N or "DMA::node0"] value 0
+    inst [N or "Normal::node0"] value 0
+    inst [N or "Normal::node1"] value 0
+
+mem.zoneinfo.protection2
+    inst [N or "DMA32::node0"] value 0
+    inst [N or "DMA::node0"] value 7016
+    inst [N or "Normal::node0"] value 0
+    inst [N or "Normal::node1"] value 0
+
+mem.zoneinfo.protection3
+    inst [N or "DMA32::node0"] value 249844
+    inst [N or "DMA::node0"] value 256864
+    inst [N or "Normal::node0"] value 0
+    inst [N or "Normal::node1"] value 0
+
+mem.zoneinfo.protection4
+    inst [N or "DMA32::node0"] value 249844
+    inst [N or "DMA::node0"] value 256864
+    inst [N or "Normal::node0"] value 0
+    inst [N or "Normal::node1"] value 0
+
 mem.zoneinfo.scanned
     inst [N or "DMA32::node0"] value 0
     inst [N or "DMA::node0"] value 0
-- 
1.8.3.1
0001-Additonal-protection-arry-metrics-of-zoneinfo.patch (application/octet-stream, 4.6 KB)
From e2f81b404e0bdbe39dff0a606fe58ec95e28fb3c Mon Sep 17 00:00:00 2001
From: Liming <[email protected]>
Date: Thu, 26 Jan 2017 14:54:55 +0800
Subject: [PATCH] Additonal protection arry metrics of zoneinfo

---
 src/pmdas/linux/help            |  4 ++++
 src/pmdas/linux/pmda.c          | 20 ++++++++++++++++++++
 src/pmdas/linux/proc_zoneinfo.c | 15 +++++++++++++++
 src/pmdas/linux/proc_zoneinfo.h |  4 ++++
 src/pmdas/linux/root_linux      |  4 ++++
 5 files changed, 47 insertions(+)

diff --git a/src/pmdas/linux/help b/src/pmdas/linux/help
index f516c97..624156e 100644
--- a/src/pmdas/linux/help
+++ b/src/pmdas/linux/help
@@ -932,6 +932,10 @@ Count of huge TLB page buddy allocation successes, from /proc/vmstat
 @ mem.zoneinfo.spanned spanned space in each zone for each NUMA node
 @ mem.zoneinfo.present present space in each zone for each NUMA node
 @ mem.zoneinfo.managed managed space in each zone for each NUMA node
+@ mem.zoneinfo.protection1 the first item of protection space in each zone for each NUMA node
+@ mem.zoneinfo.protection2 the second item of protection space in each zone for each NUMA node
+@ mem.zoneinfo.protection3 the third item of protection space in each zone for each NUMA node
+@ mem.zoneinfo.protection4 the fourth item of protection space in each zone for each NUMA node
 @ mem.ksm.full_scans Number of times that KSM has scanned for duplicated content
 @ mem.ksm.merge_across_nodes Kernel allows merging across NUMA nodes
 @ mem.ksm.pages_shared The number of nodes in the stable tree
diff --git a/src/pmdas/linux/pmda.c b/src/pmdas/linux/pmda.c
index f6cddcb..c966bdb 100644
--- a/src/pmdas/linux/pmda.c
+++ b/src/pmdas/linux/pmda.c
@@ -3585,6 +3585,26 @@ static pmdaMetric metrictab[] = {
     { PMDA_PMID(CLUSTER_ZONEINFO,7), PM_TYPE_U64, ZONEINFO_INDOM, PM_SEM_INSTANT,
       PMDA_PMUNITS(1,0,0,PM_SPACE_KBYTE,0,0) }, },
 
+/* mem.zoneinfo.protection1 */
+  { NULL,
+    { PMDA_PMID(CLUSTER_ZONEINFO,8), PM_TYPE_U64, ZONEINFO_INDOM, PM_SEM_INSTANT,
+      PMDA_PMUNITS(1,0,0,PM_SPACE_KBYTE,0,0) }, },
+
+/* mem.zoneinfo.protection2 */
+  { NULL,
+    { PMDA_PMID(CLUSTER_ZONEINFO,9), PM_TYPE_U64, ZONEINFO_INDOM, PM_SEM_INSTANT,
+      PMDA_PMUNITS(1,0,0,PM_SPACE_KBYTE,0,0) }, },
+
+/* mem.zoneinfo.protection3 */
+  { NULL,
+    { PMDA_PMID(CLUSTER_ZONEINFO,10), PM_TYPE_U64, ZONEINFO_INDOM, PM_SEM_INSTANT,
+      PMDA_PMUNITS(1,0,0,PM_SPACE_KBYTE,0,0) }, },
+
+/* mem.zoneinfo.protection4 */
+  { NULL,
+    { PMDA_PMID(CLUSTER_ZONEINFO,11), PM_TYPE_U64, ZONEINFO_INDOM, PM_SEM_INSTANT,
+      PMDA_PMUNITS(1,0,0,PM_SPACE_KBYTE,0,0) }, },
+
 /*
  * /proc/cpuinfo cluster (cpu indom)
  */
diff --git a/src/pmdas/linux/proc_zoneinfo.c b/src/pmdas/linux/proc_zoneinfo.c
index dc4e01f..8c9ce3d 100644
--- a/src/pmdas/linux/proc_zoneinfo.c
+++ b/src/pmdas/linux/proc_zoneinfo.c
@@ -22,6 +22,9 @@ refresh_proc_zoneinfo(pmInDom indom)
     int node, values;
     zoneinfo_entry_t *info;
     unsigned long long value;
+    unsigned long long value1;
+    unsigned long long value2;
+    unsigned long long value3;
     char zonetype[32];
     char instname[64];
     char buf[BUFSIZ];
@@ -96,6 +99,18 @@ refresh_proc_zoneinfo(pmInDom indom)
 		values++;
 		continue;
 	    }
+	    else if ((sscanf(buf, "        protection: (%llu, %llu, %llu, %llu)",
+                      &value, &value1, &value2, &value3)) == 4) {
+		info->values[ZONE_PROTECTION1] = (value << _pm_pageshift) / 1024;
+		values++;
+		info->values[ZONE_PROTECTION2] = (value1 << _pm_pageshift) / 1024;
+		values++;
+		info->values[ZONE_PROTECTION3] = (value2 << _pm_pageshift) / 1024;
+		values++;
+		info->values[ZONE_PROTECTION4] = (value3 << _pm_pageshift) / 1024;
+		values++;
+		continue;
+	    }
 	}
 	pmdaCacheStore(indom, PMDA_CACHE_ADD, instname, (void *)info);
 
diff --git a/src/pmdas/linux/proc_zoneinfo.h b/src/pmdas/linux/proc_zoneinfo.h
index a39c4e0..7e5f875 100644
--- a/src/pmdas/linux/proc_zoneinfo.h
+++ b/src/pmdas/linux/proc_zoneinfo.h
@@ -24,6 +24,10 @@ enum {
     ZONE_SPANNED       = 5,
     ZONE_PRESENT       = 6,
     ZONE_MANAGED       = 7,
+    ZONE_PROTECTION1   = 8,
+    ZONE_PROTECTION2   = 9,
+    ZONE_PROTECTION3   = 10,
+    ZONE_PROTECTION4   = 11,
     /* enumerate all values here */
     ZONE_VALUES	/* maximum value */
 };
diff --git a/src/pmdas/linux/root_linux b/src/pmdas/linux/root_linux
index 57c6b4d..5da1069 100644
--- a/src/pmdas/linux/root_linux
+++ b/src/pmdas/linux/root_linux
@@ -512,6 +512,10 @@ mem.zoneinfo {
     spanned		60:68:5
     present		60:68:6
     managed		60:68:7
+    protection1		60:68:8
+    protection2		60:68:9
+    protection3		60:68:10
+    protection4		60:68:11
 }
 
 swap {
-- 
1.8.3.1