pcp
[Top] [All Lists]

Re: [pcp] Invalid proc.memory.vmhwn metric

To: Nathan Scott <nathans@xxxxxxxxxx>
Subject: Re: [pcp] Invalid proc.memory.vmhwn metric
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Mon, 16 May 2016 08:27:39 +0300
Cc: pcp developers <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <612377867.47922020.1463359926228.JavaMail.zimbra@xxxxxxxxxx>
Organization: Red Hat
References: <5738B46F.3030803@xxxxxxxxxx> <612377867.47922020.1463359926228.JavaMail.zimbra@xxxxxxxxxx>
Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0
Hi,

On 2016-05-16 03:52, Nathan Scott wrote:
> ----- Original Message -----
>>
>> From http://man7.org/linux/man-pages/man5/proc.5.html:
>>
>>   * VmHWM: Peak resident set size ("high water mark").
>>
>> There's no proc.memory.vmhwm available as one would expect but
>> proc.memory.vmhwn - and it turns out that the same typo is present
>> everywhere in PCP sources so the value will always be zero.
> 
> Good catch.
> 
>> How should this be corrected? I could have sent a simple patch changing
>> hwn->hwm everywhere
> 
> Yep, that's what's needed here.  (could you send that patch through?)
> 
> We could write a pmlogrewrite(1) rule, but that seems like overkill in
> this situation.

Ok - I changed all occurrences, looks like none of the QA archives have
it (good).

---
 qa/022.out.linux                    | 2 +-
 qa/943.out                          | 4 ++--
 src/pmdas/linux_proc/help_text.h    | 2 +-
 src/pmdas/linux_proc/pmda.c         | 8 ++++----
 src/pmdas/linux_proc/proc_dynamic.c | 2 +-
 src/pmdas/linux_proc/proc_pid.c     | 4 ++--
 src/pmdas/linux_proc/proc_pid.h     | 4 ++--
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/qa/022.out.linux b/qa/022.out.linux
index 4ae6c5f..e4edc2a 100644
--- a/qa/022.out.linux
+++ b/qa/022.out.linux
@@ -35,7 +35,7 @@ proc.memory.size
 proc.memory.textrss
 proc.memory.vmdata
 proc.memory.vmexe
-proc.memory.vmhwn
+proc.memory.vmhwm
 proc.memory.vmlib
 proc.memory.vmlock
 proc.memory.vmpeak
diff --git a/qa/943.out b/qa/943.out
index a60ee8d..a375917 100644
--- a/qa/943.out
+++ b/qa/943.out
@@ -37,7 +37,7 @@ proc.memory.size -12387 No permission to perform requested 
operation
 proc.memory.textrss -12387 No permission to perform requested operation
 proc.memory.vmdata -12387 No permission to perform requested operation
 proc.memory.vmexe -12387 No permission to perform requested operation
-proc.memory.vmhwn -12387 No permission to perform requested operation
+proc.memory.vmhwm -12387 No permission to perform requested operation
 proc.memory.vmlib -12387 No permission to perform requested operation
 proc.memory.vmlock -12387 No permission to perform requested operation
 proc.memory.vmpeak -12387 No permission to perform requested operation
@@ -134,7 +134,7 @@ proc.memory.size COUNT
 proc.memory.textrss COUNT
 proc.memory.vmdata COUNT
 proc.memory.vmexe COUNT
-proc.memory.vmhwn COUNT
+proc.memory.vmhwm COUNT
 proc.memory.vmlib COUNT
 proc.memory.vmlock COUNT
 proc.memory.vmpeak COUNT
diff --git a/src/pmdas/linux_proc/help_text.h b/src/pmdas/linux_proc/help_text.h
index defd85d..8c89d2b 100644
--- a/src/pmdas/linux_proc/help_text.h
+++ b/src/pmdas/linux_proc/help_text.h
@@ -124,7 +124,7 @@ help_text_t  help_text[] = {
 { .name = "psinfo.ngid",   .shorthelp = "NUMA group identifier (from 
/proc/<pid>/status)", .longhelp = "" },
 { .name = "memory.vmpeak",     .shorthelp = "peak virtual memory size (from 
/proc/<pid>/status)",        .longhelp = "" },
 { .name = "memory.vmpin",      .shorthelp = "fixed physical address 
unswappable pages (from /proc/<pid>/status)",        .longhelp = "" },
-{ .name = "memory.vmhwn",      .shorthelp = "peak usage of physical memory 
(from /proc/<pid>/status)",        .longhelp = "" },
+{ .name = "memory.vmhwm",      .shorthelp = "peak usage of physical memory 
(from /proc/<pid>/status)",        .longhelp = "" },
 { .name = "memory.vmpte",      .shorthelp = "memory occupied by page table 
entries (from /proc/<pid>/status)",        .longhelp = "" },
 { .name = "namespaces.tgid",   .shorthelp = "descendant namespace thread group 
ID hierarchy (/proc/<pid>/status)", .longhelp = "" },
 { .name = "namespaces.pid",   .shorthelp = "descendant namespace process ID 
hierarchy (/proc/<pid>/status)", .longhelp = "" },
diff --git a/src/pmdas/linux_proc/pmda.c b/src/pmdas/linux_proc/pmda.c
index 9565256..e678c12 100644
--- a/src/pmdas/linux_proc/pmda.c
+++ b/src/pmdas/linux_proc/pmda.c
@@ -578,9 +578,9 @@ static pmdaMetric metrictab[] = {
     PM_TYPE_U32, PROC_INDOM, PM_SEM_INSTANT, 
     PMDA_PMUNITS(1,0,0,PM_SPACE_KBYTE,0,0)}},
 
-/* proc.memory.vmhwn */
+/* proc.memory.vmhwm */
   { NULL,
-    { PMDA_PMID(CLUSTER_PID_STATUS, PROC_PID_STATUS_VMHWN),
+    { PMDA_PMID(CLUSTER_PID_STATUS, PROC_PID_STATUS_VMHWM),
     PM_TYPE_U32, PROC_INDOM, PM_SEM_INSTANT, 
     PMDA_PMUNITS(1,0,0,PM_SPACE_KBYTE,0,0)}},
 
@@ -2275,8 +2275,8 @@ proc_fetchCallBack(pmdaMetric *mdesc, unsigned int inst, 
pmAtomValue *atom)
            atom->ul = (__uint32_t)strtoul(f, &tail, 0);
        break;
 
-       case PROC_PID_STATUS_VMHWN: /* proc.memory.vmhwn */
-       if ((f = _pm_getfield(entry->status_lines.vmhwn, 1)) == NULL)
+       case PROC_PID_STATUS_VMHWM: /* proc.memory.vmhwm */
+       if ((f = _pm_getfield(entry->status_lines.vmhwm, 1)) == NULL)
            atom->ul = 0;
        else
            atom->ul = (__uint32_t)strtoul(f, &tail, 0);
diff --git a/src/pmdas/linux_proc/proc_dynamic.c 
b/src/pmdas/linux_proc/proc_dynamic.c
index 335833e..3b9e839 100644
--- a/src/pmdas/linux_proc/proc_dynamic.c
+++ b/src/pmdas/linux_proc/proc_dynamic.c
@@ -177,7 +177,7 @@ static dynproc_metric_t memory_metrics[] = {
         { .name = "vmswap", .cluster = CLUSTER_PID_STATUS,  .item=27 },
         { .name = "vmpeak",    .cluster = CLUSTER_PID_STATUS,  .item = 
PROC_PID_STATUS_VMPEAK },
        { .name = "vmpin",      .cluster = CLUSTER_PID_STATUS,  .item = 
PROC_PID_STATUS_VMPIN },
-       { .name = "vmhwn",      .cluster = CLUSTER_PID_STATUS,  .item = 
PROC_PID_STATUS_VMHWN },
+       { .name = "vmhwm",      .cluster = CLUSTER_PID_STATUS,  .item = 
PROC_PID_STATUS_VMHWM },
        { .name = "vmpte",      .cluster = CLUSTER_PID_STATUS,  .item = 
PROC_PID_STATUS_VMPTE },
 };
 
diff --git a/src/pmdas/linux_proc/proc_pid.c b/src/pmdas/linux_proc/proc_pid.c
index adb526f..6ea2d64 100644
--- a/src/pmdas/linux_proc/proc_pid.c
+++ b/src/pmdas/linux_proc/proc_pid.c
@@ -1482,8 +1482,8 @@ fetch_proc_pid_status(int id, proc_pid_t *proc_pid, int 
*sts)
                            ep->status_lines.vmlck = strsep(&curline, "\n");
                        else if (strncmp(curline, "VmPin:", 6) == 0)
                            ep->status_lines.vmpin = strsep(&curline, "\n");
-                       else if (strncmp(curline, "VmHWN:", 6) == 0)
-                           ep->status_lines.vmhwn = strsep(&curline, "\n");
+                       else if (strncmp(curline, "VmHWM:", 6) == 0)
+                           ep->status_lines.vmhwm = strsep(&curline, "\n");
                        else if (strncmp(curline, "VmRSS:", 6) == 0)
                            ep->status_lines.vmrss = strsep(&curline, "\n");
                        else if (strncmp(curline, "VmData:", 7) == 0)
diff --git a/src/pmdas/linux_proc/proc_pid.h b/src/pmdas/linux_proc/proc_pid.h
index bebe74d..ef9b5a7 100644
--- a/src/pmdas/linux_proc/proc_pid.h
+++ b/src/pmdas/linux_proc/proc_pid.h
@@ -115,7 +115,7 @@ enum {
     PROC_PID_STATUS_NGID,
     PROC_PID_STATUS_VMPEAK,
     PROC_PID_STATUS_VMPIN,
-    PROC_PID_STATUS_VMHWN,
+    PROC_PID_STATUS_VMHWM,
     PROC_PID_STATUS_VMPTE,
     PROC_PID_STATUS_NSTGID,
     PROC_PID_STATUS_NSPID,
@@ -200,7 +200,7 @@ typedef struct {    /* /proc/<pid>/status */
     char *vmsize;
     char *vmlck;
     char *vmpin;
-    char *vmhwn;
+    char *vmhwm;
     char *vmrss;
     char *vmdata;
     char *vmstk;

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>