Hi:
When I see ipc shared memory metrics, I find there is no metric about the
number
of currently existing segments. I think it's needed. So make this patch to
add the metric.
From 084bb078d6d1f4374f056b2d30ae35ca8051063c Mon Sep 17 00:00:00 2001
From: wulm <wulm.fnst@xxxxxxxxxxxxxx>
Date: Tue, 24 May 2016 04:20:46 -0400
Subject: [PATCH] Add the metric about currently existing segments
---
src/pmdas/linux/help | 1 +
src/pmdas/linux/ipc.c | 1 +
src/pmdas/linux/ipc.h | 1 +
src/pmdas/linux/pmda.c | 8 ++++++++
src/pmdas/linux/root_linux | 1 +
5 files changed, 12 insertions(+)
diff --git a/src/pmdas/linux/help b/src/pmdas/linux/help
index cc92ff0..7752c2d 100644
--- a/src/pmdas/linux/help
+++ b/src/pmdas/linux/help
@@ -1498,6 +1498,7 @@ See also the kernel.uname.* metrics
@ ipc.shm.tot total number of shared memory pages (from shmctl(..,SHM_INFO,..))
@ ipc.shm.rss number of resident shared memory pages (from
shmctl(..,SHM_INFO,..))
@ ipc.shm.swp number of swapped shared memory pages (from
shmctl(..,SHM_INFO,..))
+@ ipc.shm.used_ids number of currently existing segments (from
shmctl(..,SHM_INFO,..))
@ vfs.files.count number of in-use file structures
@ vfs.files.free number of available file structures
diff --git a/src/pmdas/linux/ipc.c b/src/pmdas/linux/ipc.c
index 28b44c2..b9db6c1 100644
--- a/src/pmdas/linux/ipc.c
+++ b/src/pmdas/linux/ipc.c
@@ -33,6 +33,7 @@ refresh_shm_info(shm_info_t *_shm_info)
_shm_info->shm_tot = shm_info.shm_tot * _pm_system_pagesize;
_shm_info->shm_rss = shm_info.shm_rss * _pm_system_pagesize;
_shm_info->shm_swp = shm_info.shm_swp * _pm_system_pagesize;
+ _shm_info->used_ids = shm_info.used_ids;
return 0;
}
diff --git a/src/pmdas/linux/ipc.h b/src/pmdas/linux/ipc.h
index 79f3068..5072742 100644
--- a/src/pmdas/linux/ipc.h
+++ b/src/pmdas/linux/ipc.h
@@ -17,6 +17,7 @@ typedef struct {
unsigned int shm_tot; /* total allocated shm */
unsigned int shm_rss; /* total resident shm */
unsigned int shm_swp; /* total swapped shm */
+ unsigned int used_ids; /* currently existing segments */
} shm_info_t;
extern int refresh_shm_info(shm_info_t *);
diff --git a/src/pmdas/linux/pmda.c b/src/pmdas/linux/pmda.c
index ffc67ce..ca97b1f 100644
--- a/src/pmdas/linux/pmda.c
+++ b/src/pmdas/linux/pmda.c
@@ -3698,6 +3698,11 @@ static pmdaMetric metrictab[] = {
{ PMDA_PMID(CLUSTER_SHM_INFO, 2), PM_TYPE_U32, PM_INDOM_NULL,
PM_SEM_INSTANT,
PMDA_PMUNITS(1,0,0,PM_SPACE_BYTE,0,0)}},
+/* ipc.shm.used_ids */
+ { NULL,
+ { PMDA_PMID(CLUSTER_SHM_INFO, 3), PM_TYPE_U32, PM_INDOM_NULL,
PM_SEM_INSTANT,
+ PMDA_PMUNITS(0,0,0,0,0,0)}},
+
/*
* shared memory limits cluster
* Cluster added by Mike Mason <mmlnx@xxxxxxxxxx>
@@ -6099,6 +6104,9 @@ linux_fetchCallBack(pmdaMetric *mdesc, unsigned int inst,
pmAtomValue *atom)
case 2: /* ipc.shm.swp */
atom->ul = _shm_info.shm_swp;
break;
+ case 3: /* ipc.shm.used_ids */
+ atom->ul = _shm_info.used_ids;
+ break;
default:
return PM_ERR_PMID;
}
diff --git a/src/pmdas/linux/root_linux b/src/pmdas/linux/root_linux
index 16f702d..a3410d3 100644
--- a/src/pmdas/linux/root_linux
+++ b/src/pmdas/linux/root_linux
@@ -233,6 +233,7 @@ ipc.shm {
tot 60:56:0
rss 60:56:1
swp 60:56:2
+ used_ids 60:56:3
}
wuliming
best regards
0001-Add-the-metric-about-currently-existing-segments.patch
Description: 0001-Add-the-metric-about-currently-existing-segments.patch
|