pcp
[Top] [All Lists]

Re: [pcp] Hotproc fixes

To: Nathan Scott <nathans@xxxxxxxxxx>
Subject: Re: [pcp] Hotproc fixes
From: Martins Innus <minnus@xxxxxxxxxxx>
Date: Sun, 26 Apr 2015 13:22:05 -0400
Cc: myllynen@xxxxxxxxxx, pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <206370475.5905649.1429846876286.JavaMail.zimbra@xxxxxxxxxx>
References: <5536A934.8040002@xxxxxxxxxxx> <5537A154.2090803@xxxxxxxxxx> <5537A3F3.5060204@xxxxxxxxxxx> <233739221.5258413.1429764654377.JavaMail.zimbra@xxxxxxxxxx> <55392BAB.3060101@xxxxxxxxxxx> <206370475.5905649.1429846876286.JavaMail.zimbra@xxxxxxxxxx>
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
Nathan,

On 4/23/2015 11:41 PM, Nathan Scott wrote:

----- Original Message -----
[...]
OK, tracked this down.  Only happens on some OSs.  I had assumed that
all of /proc/<pid>/* should be available and files would only be missing
if some badness happened or a pid was in the process of exiting.  Turns
out that schedstat is not enabled in some kernels by default.  Will need
a bit of rework to deal with this.
Now that I think about it, the /proc/pid/io entry is in the same boat...
the kernel fs/proc/base.c code has -

#ifdef CONFIG_TASK_IO_ACCOUNTING
         ONE("io",       S_IRUSR, proc_tgid_io_accounting),
#endif


Yup, probably also need the following guards, but I don't have a system without these entries to test for sure.

https://github.com/ubccr/pcp/tree/hotproc_cleanups

Martins

diff --git a/src/pmdas/linux_proc/proc_pid.c b/src/pmdas/linux_proc/proc_pid.c
index 442c5b4..10077d7 100644
--- a/src/pmdas/linux_proc/proc_pid.c
+++ b/src/pmdas/linux_proc/proc_pid.c
@@ -545,7 +545,9 @@ hotproc_eval_procs(void)
        /* IO demand */
        /* Read */
        
-       if ((f = _pm_getfield(ioentry->io_lines.readb, 1)) == NULL)
+        if( !ioentry ) /* ioentry is not enabled on all kernels */
+            ull = 0;
+       else if ((f = _pm_getfield(ioentry->io_lines.readb, 1)) == NULL)
            ull = 0;
        else
            ull = (__uint64_t)strtoull(f, &tail, 0);
@@ -554,7 +556,9 @@ hotproc_eval_procs(void)
/* Write */ - if ((f = _pm_getfield(ioentry->io_lines.writeb, 1)) == NULL)
+        if( !ioentry ) /* ioentry is not enabled on all kernels */
+            ull = 0;
+       else if ((f = _pm_getfield(ioentry->io_lines.writeb, 1)) == NULL)
            ull = 0;
        else
            ull = (__uint64_t)strtoull(f, &tail, 0);


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