From nscott@aconex.com Tue Feb 6 15:32:19 2007 Received: with ECARTIS (v1.0.0; list pcp); Tue, 06 Feb 2007 15:32:25 -0800 (PST) X-Spam-oss-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.0-pre1-r497472 Received: from postoffice.aconex.com (mail.app.aconex.com [203.89.192.138]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l16NWH3c007537 for ; Tue, 6 Feb 2007 15:32:19 -0800 Received: from edge (unknown [203.89.192.141]) by postoffice.aconex.com (Postfix) with ESMTP id C3E79AAC303; Wed, 7 Feb 2007 10:17:32 +1100 (EST) Subject: [PATCH] fix typos in pcp.conf(4) man page From: Nathan Scott Reply-To: nscott@aconex.com To: Michael Newton , Mark Goodwin Cc: pcp@oss.sgi.com Content-Type: multipart/mixed; boundary="=-cgVZlI8YkOu3V9mDAPKV" Organization: Aconex Date: Wed, 07 Feb 2007 10:33:00 +1100 Message-Id: <1170804780.26078.4.camel@edge> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-archive-position: 879 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: nscott@aconex.com Precedence: bulk X-list: pcp Content-Length: 1732 Lines: 63 --=-cgVZlI8YkOu3V9mDAPKV Content-Type: text/plain Content-Transfer-Encoding: 7bit SSIA. -- Nathan --=-cgVZlI8YkOu3V9mDAPKV Content-Disposition: attachment; filename=fix-pcp.conf-man-page Content-Type: text/x-patch; name=fix-pcp.conf-man-page; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: devpcp/man/man4/pcp.conf.4 =================================================================== --- devpcp.orig/man/man4/pcp.conf.4 2007-02-07 09:57:06.341519000 +1100 +++ devpcp/man/man4/pcp.conf.4 2007-02-07 09:59:30.230511500 +1100 @@ -26,10 +26,10 @@ .TH PCP conf.4 "SGI" "Performance Co-Pilot" \} .el \{\ -.if \nX=0 .ds x} PCP.ENV 4 "SGI" "Performance Co-Pilot" -.if \nX=1 .ds x} PCP.ENV 4 "Performance Co-Pilot" -.if \nX=2 .ds x} PCP.ENV 4 "" "\&" -.if \nX=3 .ds x} PCP.ENV "" "" "\&" +.if \nX=0 .ds x} PCP.CONF 4 "SGI" "Performance Co-Pilot" +.if \nX=1 .ds x} PCP.CONF 4 "Performance Co-Pilot" +.if \nX=2 .ds x} PCP.CONF 4 "" "\&" +.if \nX=3 .ds x} PCP.CONF "" "" "\&" .TH \*(x} .rr X \} @@ -49,7 +49,7 @@ various PCP pieces in the file system an shell scripts by sourcing the .IR /etc/pcp.env (4) shell script and queried by C/C++ programs using the -.IR __pmGetConfig (3) +.IR pmGetConfig (3) library function. If a variable is already defined in the environment, the values in @@ -105,7 +105,7 @@ This is required because the file may be sourced directly by Makefiles as well as interpreted by the .I pcp.env script and the -.I "__pmGetConfig" +.I "pmGetConfig" function. .IP 5. 4 variable values may contain spaces and should @@ -132,6 +132,6 @@ file. .BR PCPIntro (1), .BR PCPIntro (3), .BR PMAPI (3), -.BR __pmGetConfig (3) +.BR pmGetConfig (3) and .BR pcp.env (4). --=-cgVZlI8YkOu3V9mDAPKV-- From kimbrr@melbourne.sgi.com Wed Feb 7 17:29:01 2007 Received: with ECARTIS (v1.0.0; list pcp); Wed, 07 Feb 2007 17:29:09 -0800 (PST) X-Spam-oss-Status: No, score=0.0 required=5.0 tests=BAYES_50 autolearn=ham version=3.2.0-pre1-r497472 Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id l181Sum7031916 for ; Wed, 7 Feb 2007 17:28:59 -0800 Received: from snort.melbourne.sgi.com (snort.melbourne.sgi.com [134.14.54.149]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id MAA24969; Thu, 8 Feb 2007 12:10:39 +1100 Received: from snort.melbourne.sgi.com (localhost [127.0.0.1]) by snort.melbourne.sgi.com (SGI-8.12.5/8.12.5) with ESMTP id l181Ac7Y117200341; Thu, 8 Feb 2007 12:10:38 +1100 (AEDT) Received: from localhost (kimbrr@localhost) by snort.melbourne.sgi.com (SGI-8.12.5/8.12.5/Submit) with ESMTP id l181AZEJ116963202; Thu, 8 Feb 2007 12:10:37 +1100 (AEDT) X-Authentication-Warning: snort.melbourne.sgi.com: kimbrr owned process doing -bs Date: Thu, 8 Feb 2007 12:10:35 +1100 From: Michael Newton To: Nathan Scott cc: Mark Goodwin , pcp@oss.sgi.com, Daniel Moore Subject: Re: [PATCH] Fix Linux PMDA CPU time metrics In-Reply-To: <1164090739.4695.301.camel@edge> Message-ID: References: <1164090739.4695.301.camel@edge> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 889 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: kimbrr@melbourne.sgi.com Precedence: bulk X-list: pcp Content-Length: 2039 Lines: 44 On Tue, 21 Nov 2006, Nathan Scott wrote: > This patch fixes the precision of the allcpu and percpu millisecond > counters. This has been the source of problems in the past, and it > looks like we missed another size transition awhile back in 2.6.5+. > > Historically, 2.4 and earlier kernels used a funky int/long mix for > idle and other CPU times. Some code was put in to try to circumvent > counter wrapping, in the agent, back then (hohum). Then, in 2.6.0, > though 2.6.4 (inclusive) all CPU time counters were made 32 bits for > all platforms (argh!). Then, in 2.6.5 (and beyond) _all_ CPU time > counters got changed to be 64 bits unconditionally. > > At least someone finally got it right. :] However, we missed this > last transition to 64 bits, and the Linux agent hasn't been updated. > This patch does that, and dynamically sets the type of the CPU time > metrics depending on the 3 kernel versions/flavours. + if (sscanf(kernel_uname.release, "%d.%d", &major, &minor) == 2) { + if (major < 2 || (major == 2 && minor <= 4)) { /* 2.4 and earlier */ + fprintf(stderr, "NOTICE: using kernel 2.4 or earlier CPU types\n"); + _pm_ctxt_size = 4; + _pm_intr_size = 4; + _pm_cputime_size = 4; + _pm_idletime_size = sizeof(unsigned long); + } + else if (major == 2 && minor >= 0 && minor <= 4) { /* 2.6.0->.4 */ + fprintf(stderr, "NOTICE: using kernel 2.6.0 to 2.6.4 CPU types\n"); + _pm_cputime_size = 4; + _pm_idletime_size = 4; + } + else + fprintf(stderr, "NOTICE: using 64 bit CPU time types\n"); + } Looks to me like your "else if" clause will never happen.. aren't you missing a variable to contain the 3rd element of the release number (major.minor.missing) ? Only thing im not sure on is, did linux kernel release nums always have 3 components, or do we have to handle the possibility that earlier ones may have only 2? PS: im not sure if you got the news Daniel is now my (immediate) boss From nscott@aconex.com Wed Feb 7 18:29:16 2007 Received: with ECARTIS (v1.0.0; list pcp); Wed, 07 Feb 2007 18:29:28 -0800 (PST) X-Spam-oss-Status: No, score=-0.2 required=5.0 tests=BAYES_40 autolearn=ham version=3.2.0-pre1-r497472 Received: from postoffice.aconex.com (mail.app.aconex.com [203.89.192.138]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l182TEm7005838 for ; Wed, 7 Feb 2007 18:29:15 -0800 Received: from edge (unknown [203.89.192.141]) by postoffice.aconex.com (Postfix) with ESMTP id 912E7AAC548; Thu, 8 Feb 2007 13:14:18 +1100 (EST) Subject: Re: [PATCH] Fix Linux PMDA CPU time metrics From: Nathan Scott Reply-To: nscott@aconex.com To: Michael Newton Cc: Mark Goodwin , pcp@oss.sgi.com, Daniel Moore In-Reply-To: References: <1164090739.4695.301.camel@edge> Content-Type: multipart/mixed; boundary="=-SgCiEPJ3shOJqjMQxkCZ" Organization: Aconex Date: Thu, 08 Feb 2007 13:30:05 +1100 Message-Id: <1170901805.26078.56.camel@edge> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-archive-position: 890 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: nscott@aconex.com Precedence: bulk X-list: pcp Content-Length: 21387 Lines: 579 --=-SgCiEPJ3shOJqjMQxkCZ Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi Michael, On Thu, 2007-02-08 at 12:10 +1100, Michael Newton wrote: > ... > Looks to me like your "else if" clause will never happen.. aren't you > missing a variable to contain the 3rd element of the release number > (major.minor.missing) ? Only thing im not sure on is, did linux > kernel release nums always have 3 components, or do we have to handle > the possibility that earlier ones may have only 2? Right you are - good catch. I've written a little test program (attached) to test out a few combinations, and a fixed patch is also attached. I'm not sure if there were early releases (pre- 2.6) that had only two release numbers, but the code now handles it just in case (done with just the one sscanf, so no noticable extra complexity in handling it)... 13:15 nathans@edge ~ 894> cc x.c 13:15 nathans@edge ~ 895> ./a.out 2.4 i=2 major=2 minor=4 release=0 13:15 nathans@edge ~ 896> ./a.out 2.4.2 i=3 major=2 minor=4 release=2 13:18 nathans@edge ~ 897> > PS: im not sure if you got the news Daniel is now my (immediate) boss Nope, hadn't heard (though I did hear about mini-dxm, congratulations!). cheers. -- Nathan --=-SgCiEPJ3shOJqjMQxkCZ Content-Disposition: attachment; filename=x.c Content-Type: text/x-csrc; name=x.c; charset=UTF-8 Content-Transfer-Encoding: 7bit #include int main(int argc, char **argv) { int major, minor, release=0, i; i = sscanf(argv[1], "%d.%d.%d", &major, &minor, &release); printf("i=%d major=%d minor=%d release=%d\n", i, major, minor, release); } --=-SgCiEPJ3shOJqjMQxkCZ Content-Disposition: attachment; filename=fix-linux-percpu-metrics Content-Type: text/x-patch; name=fix-linux-percpu-metrics; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: devpcp/src/pmdas/linux/pmda.c =================================================================== --- devpcp.orig/src/pmdas/linux/pmda.c 2006-11-30 13:46:09.594277250 +1100 +++ devpcp/src/pmdas/linux/pmda.c 2007-02-08 13:16:14.207876500 +1100 @@ -80,12 +80,26 @@ */ #if defined(HAVE_64BIT_LONG) #define KERNEL_ULONG PM_TYPE_U64 -#define _pm_assign_ulong(atomp, val) (atomp)->ull = val +#define _pm_assign_ulong(atomp, val) do { (atomp)->ull = (val); } while (0) #else #define KERNEL_ULONG PM_TYPE_U32 -#define _pm_assign_ulong(atomp, val) (atomp)->ul = val +#define _pm_assign_ulong(atomp, val) do { (atomp)->ul = (val); } while (0) #endif +/* + * Some metrics need to have their type set at runtime, based on the + * running kernel version (not simply a 64 vs 32 bit machine issue). + */ +#define KERNEL_UTYPE PM_TYPE_NOSUPPORT /* set to real type at runtime */ +#define _pm_metric_type(type, size) \ + do { \ + (type) = ((size)==8 ? PM_TYPE_U64 : PM_TYPE_U32); \ + } while (0) +#define _pm_assign_utype(size, atomp, val) \ + do { \ + if ((size)==8) { (atomp)->ull = (val); } else { (atomp)->ul = (val); } \ + } while (0) + static proc_stat_t proc_stat; static proc_meminfo_t proc_meminfo; static proc_loadavg_t proc_loadavg; @@ -117,6 +131,10 @@ static int _isDSO = 1; /* =0 I am a dae /* globals */ size_t _pm_system_pagesize; /* for hinv.pagesize and used elsewhere */ int _pm_have_proc_vmstat; /* if /proc/vmstat is available */ +int _pm_intr_size; /* size in bytes of interrupt sum count metric */ +int _pm_ctxt_size; /* size in bytes of context switch count metric */ +int _pm_cputime_size; /* size in bytes of most of the cputime metrics */ +int _pm_idletime_size; /* size in bytes of the idle cputime metric */ /* * Metric Instance Domains (statically initialized ones only) @@ -201,22 +219,22 @@ static pmdaMetric metrictab[] = { /* kernel.percpu.cpu.user */ { NULL, - { PMDA_PMID(CLUSTER_STAT,0), PM_TYPE_U32, CPU_INDOM, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,0), KERNEL_UTYPE, CPU_INDOM, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* kernel.percpu.cpu.nice */ { NULL, - { PMDA_PMID(CLUSTER_STAT,1), PM_TYPE_U32, CPU_INDOM, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,1), KERNEL_UTYPE, CPU_INDOM, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* kernel.percpu.cpu.sys */ { NULL, - { PMDA_PMID(CLUSTER_STAT,2), PM_TYPE_U32, CPU_INDOM, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,2), KERNEL_UTYPE, CPU_INDOM, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* kernel.percpu.cpu.idle */ { NULL, - { PMDA_PMID(CLUSTER_STAT,3), KERNEL_ULONG, CPU_INDOM, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,3), KERNEL_UTYPE, CPU_INDOM, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* disk.dev.read */ @@ -301,12 +319,12 @@ static pmdaMetric metrictab[] = { /* kernel.all.intr */ { NULL, - { PMDA_PMID(CLUSTER_STAT,12), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,12), KERNEL_UTYPE, PM_INDOM_NULL, PM_SEM_COUNTER, PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, }, /* kernel.all.pswitch */ { NULL, - { PMDA_PMID(CLUSTER_STAT,13), KERNEL_ULONG, PM_INDOM_NULL, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,13), KERNEL_UTYPE, PM_INDOM_NULL, PM_SEM_COUNTER, PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) }, }, /* kernel.all.sysfork */ @@ -317,22 +335,22 @@ static pmdaMetric metrictab[] = { /* kernel.all.cpu.user */ { NULL, - { PMDA_PMID(CLUSTER_STAT,20), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,20), KERNEL_UTYPE, PM_INDOM_NULL, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* kernel.all.cpu.nice */ { NULL, - { PMDA_PMID(CLUSTER_STAT,21), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,21), KERNEL_UTYPE, PM_INDOM_NULL, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* kernel.all.cpu.sys */ { NULL, - { PMDA_PMID(CLUSTER_STAT,22), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,22), KERNEL_UTYPE, PM_INDOM_NULL, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* kernel.all.cpu.idle */ { NULL, - { PMDA_PMID(CLUSTER_STAT,23), KERNEL_ULONG, PM_INDOM_NULL, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,23), KERNEL_UTYPE, PM_INDOM_NULL, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* disk.all.read */ @@ -377,12 +395,12 @@ static pmdaMetric metrictab[] = { /* kernel.percpu.cpu.wait.total */ { NULL, - { PMDA_PMID(CLUSTER_STAT,30), PM_TYPE_U32, CPU_INDOM, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,30), KERNEL_UTYPE, CPU_INDOM, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* kernel.percpu.cpu.intr */ { NULL, - { PMDA_PMID(CLUSTER_STAT,31), PM_TYPE_U32, CPU_INDOM, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,31), KERNEL_UTYPE, CPU_INDOM, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* hinv.ncpu */ @@ -397,12 +415,12 @@ static pmdaMetric metrictab[] = { /* kernel.all.cpu.intr */ { NULL, - { PMDA_PMID(CLUSTER_STAT,34), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,34), KERNEL_UTYPE, PM_INDOM_NULL, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* kernel.all.cpu.wait.total */ { NULL, - { PMDA_PMID(CLUSTER_STAT,35), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER, + { PMDA_PMID(CLUSTER_STAT,35), KERNEL_UTYPE, PM_INDOM_NULL, PM_SEM_COUNTER, PMDA_PMUNITS(0,1,0,0,PM_TIME_MSEC,0) }, }, /* kernel.all.hz */ @@ -3067,16 +3085,20 @@ linux_fetchCallBack(pmdaMetric *mdesc, u */ switch (idp->item) { case 0: /* user */ - atom->ul = 1000 * (double)proc_stat.p_user[inst] / proc_stat.hz; + _pm_assign_utype(_pm_cputime_size, atom, + 1000 * (double)proc_stat.p_user[inst] / proc_stat.hz); break; case 1: /* nice */ - atom->ul = 1000 * (double)proc_stat.p_nice[inst] / proc_stat.hz; + _pm_assign_utype(_pm_cputime_size, atom, + 1000 * (double)proc_stat.p_nice[inst] / proc_stat.hz); break; case 2: /* sys */ - atom->ul = 1000 * (double)proc_stat.p_sys[inst] / proc_stat.hz; + _pm_assign_utype(_pm_cputime_size, atom, + 1000 * (double)proc_stat.p_sys[inst] / proc_stat.hz); break; case 3: /* idle */ - _pm_assign_ulong(atom, 1000 * (double)proc_stat.p_idle[inst] / proc_stat.hz); + _pm_assign_utype(_pm_idletime_size, atom, + 1000 * (double)proc_stat.p_idle[inst] / proc_stat.hz); break; case 8: /* pagesin */ @@ -3104,10 +3126,10 @@ linux_fetchCallBack(pmdaMetric *mdesc, u atom->ul = proc_stat.page[1]; break; case 12: /* intr */ - atom->ul = proc_stat.intr[0]; + _pm_assign_utype(_pm_intr_size, atom, proc_stat.intr); break; case 13: /* ctxt */ - _pm_assign_ulong(atom, proc_stat.ctxt); + _pm_assign_utype(_pm_ctxt_size, atom, proc_stat.intr); break; case 14: /* processes */ _pm_assign_ulong(atom, proc_stat.processes); @@ -3115,31 +3137,39 @@ linux_fetchCallBack(pmdaMetric *mdesc, u /* gilly - change the calculation to prevent a bug */ case 20: /* all.user */ - atom->ul = 1000 * (double)proc_stat.user / proc_stat.hz; + _pm_assign_utype(_pm_cputime_size, atom, + 1000 * (double)proc_stat.user / proc_stat.hz); break; case 21: /* all.nice */ - atom->ul = 1000 * (double)proc_stat.nice / proc_stat.hz; + _pm_assign_utype(_pm_cputime_size, atom, + 1000 * (double)proc_stat.nice / proc_stat.hz); break; case 22: /* all.sys */ - atom->ul = 1000 * (double)proc_stat.sys / proc_stat.hz; + _pm_assign_utype(_pm_cputime_size, atom, + 1000 * (double)proc_stat.sys / proc_stat.hz); break; case 23: /* all.idle */ - _pm_assign_ulong(atom, 1000 * (double)proc_stat.idle / proc_stat.hz); + _pm_assign_utype(_pm_idletime_size, atom, + 1000 * (double)proc_stat.idle / proc_stat.hz); break; case 30: /* kernel.percpu.cpu.wait.total */ - atom->ul = 1000 * (double)proc_stat.p_wait[inst] / proc_stat.hz; + _pm_assign_utype(_pm_cputime_size, atom, + 1000 * (double)proc_stat.p_wait[inst] / proc_stat.hz); break; case 31: /* kernel.percpu.cpu.intr */ - atom->ul = 1000 * ((double)proc_stat.p_irq[inst] + - (double)proc_stat.p_sirq[inst]) / proc_stat.hz; + _pm_assign_utype(_pm_cputime_size, atom, + 1000 * ((double)proc_stat.p_irq[inst] + + (double)proc_stat.p_sirq[inst]) / proc_stat.hz); break; case 34: /* kernel.all.cpu.intr */ - atom->ul = 1000 * ((double)proc_stat.irq + - (double)proc_stat.sirq) / proc_stat.hz; + _pm_assign_utype(_pm_cputime_size, atom, + 1000 * ((double)proc_stat.irq + + (double)proc_stat.sirq) / proc_stat.hz); break; case 35: /* kernel.all.cpu.wait.total */ - atom->ul = 1000 * (double)proc_stat.wait / proc_stat.hz; + _pm_assign_utype(_pm_cputime_size, atom, + 1000 * (double)proc_stat.wait / proc_stat.hz); break; case 32: /* hinv.ncpu */ atom->ul = indomtab[CPU_INDOM].it_numinst; @@ -4319,6 +4349,8 @@ void linux_init(pmdaInterface *dp) { int need_refresh[NUM_CLUSTERS]; + int i, major, minor, release = 0; + __pmID_int *idp; _pm_system_pagesize = getpagesize(); if (_isDSO) { @@ -4343,6 +4375,69 @@ linux_init(pmdaInterface *dp) proc_scsi.scsi_indom = &indomtab[SCSI_INDOM]; proc_slabinfo.indom = &indomtab[SLAB_INDOM]; + /* + * Figure out kernel version. The precision of certain metrics + * (e.g. percpu time counters) has changed over kernel versions. + * See include/linux/kernel_stat.h for all the various flavours. + */ + uname(&kernel_uname); + _pm_ctxt_size = 8; + _pm_intr_size = 8; + _pm_cputime_size = 8; + _pm_idletime_size = 8; + i = sscanf(kernel_uname.release, "%d.%d.%d", &major, &minor, &release); + if (i == 2 || i == 3) { + /* 2.4 and earlier... */ + if (major < 2 || (major == 2 && minor <= 4)) { + fprintf(stderr, "NOTICE: using kernel 2.4 or earlier CPU types\n"); + _pm_ctxt_size = 4; + _pm_intr_size = 4; + _pm_cputime_size = 4; + _pm_idletime_size = sizeof(unsigned long); + } + /* 2.6.0->2.6.4... */ + else if (major == 2 && minor == 6 && release >= 0 && release <= 4) { + fprintf(stderr, "NOTICE: using kernel 2.6.0 to 2.6.4 CPU types\n"); + _pm_cputime_size = 4; + _pm_idletime_size = 4; + } + /* all recent kernels... */ + else + fprintf(stderr, "NOTICE: using 64 bit CPU time types\n"); + } + for (i = 0; i < sizeof(metrictab)/sizeof(metrictab[0]); i++) { + idp = (__pmID_int *)&(metrictab[i].m_desc.pmid); + if (idp->cluster == CLUSTER_STAT) { + switch (idp->item) { + case 0: /* kernel.percpu.cpu.user */ + case 1: /* kernel.percpu.cpu.nice */ + case 2: /* kernel.percpu.cpu.sys */ + case 20: /* kernel.all.cpu.user */ + case 21: /* kernel.all.cpu.nice */ + case 22: /* kernel.all.cpu.sys */ + case 30: /* kernel.percpu.cpu.wait.total */ + case 31: /* kernel.percpu.cpu.intr */ + case 34: /* kernel.all.cpu.intr */ + case 35: /* kernel.all.cpu.wait.total */ + _pm_metric_type(metrictab[i].m_desc.type, _pm_cputime_size); + break; + case 3: /* kernel.percpu.cpu.idle */ + case 23: /* kernel.all.cpu.idle */ + _pm_metric_type(metrictab[i].m_desc.type, _pm_idletime_size); + break; + case 12: /* kernel.all.intr */ + _pm_metric_type(metrictab[i].m_desc.type, _pm_intr_size); + break; + case 13: /* kernel.all.pswitch */ + _pm_metric_type(metrictab[i].m_desc.type, _pm_ctxt_size); + break; + } + } + if (metrictab[i].m_desc.type == PM_TYPE_NOSUPPORT) + fprintf(stderr, "Bad kernel metric descriptor type (%u.%u)\n", + idp->cluster, idp->item); + } + /* * Read System.map and /proc/ksyms. Used to translate wait channel * addresses to symbol names. Index: devpcp/src/pmdas/linux/proc_stat.c =================================================================== --- devpcp.orig/src/pmdas/linux/proc_stat.c 2006-11-30 13:45:52.061181500 +1100 +++ devpcp/src/pmdas/linux/proc_stat.c 2006-11-30 13:46:09.742286500 +1100 @@ -64,9 +64,6 @@ refresh_proc_stat(proc_cpuinfo_t *proc_c int n; int i; int j; - unsigned long cur_idle; - struct utsname kversion; - static int have_long_idle_metric = -1; if ((fd = open("/proc/stat", O_RDONLY)) < 0) { return -errno; @@ -90,17 +87,6 @@ refresh_proc_stat(proc_cpuinfo_t *proc_c bufindex = (char **)malloc(maxbufindex * sizeof(char *)); } - if (have_long_idle_metric < 0) { - memset(&kversion, 0, sizeof(kversion)); - if (uname(&kversion) == 0) { - have_long_idle_metric = - strncmp(kversion.release, "2.2", 3) == 0 || - strncmp(kversion.release, "2.4", 3) == 0; - } - else - fprintf(stderr, "refresh_proc_stat: warning: uname() failed: %s\n", strerror(errno)); - } - nbufindex = 0; bufindex[nbufindex++] = statbuf; for (i=0; i < n; i++) { @@ -142,68 +128,40 @@ refresh_proc_stat(proc_cpuinfo_t *proc_c proc_stat->cpu_indom->it_set[i].i_name = cpu_name(proc_cpuinfo, i); } - /* - * All cpu metrics are "unsigned int" except idle, - * which is "unsigned long" on 2.4.x kernels and - * "unsigned int" on 2.6.x kernels. - */ - n = proc_stat->ncpu * sizeof(unsigned int); - proc_stat->p_user = (unsigned int *)malloc(n); - proc_stat->p_nice = (unsigned int *)malloc(n); - proc_stat->p_sys = (unsigned int *)malloc(n); - proc_stat->p_wait = (unsigned int *)malloc(n); - proc_stat->p_irq = (unsigned int *)malloc(n); - proc_stat->p_sirq = (unsigned int *)malloc(n); + n = proc_stat->ncpu * sizeof(unsigned long long); + proc_stat->p_user = (unsigned long long *)malloc(n); + proc_stat->p_nice = (unsigned long long *)malloc(n); + proc_stat->p_sys = (unsigned long long *)malloc(n); + proc_stat->p_idle = (unsigned long long *)malloc(n); + proc_stat->p_wait = (unsigned long long *)malloc(n); + proc_stat->p_irq = (unsigned long long *)malloc(n); + proc_stat->p_sirq = (unsigned long long *)malloc(n); memset(proc_stat->p_user, 0, n); memset(proc_stat->p_nice, 0, n); memset(proc_stat->p_sys, 0, n); + memset(proc_stat->p_idle, 0, n); memset(proc_stat->p_wait, 0, n); memset(proc_stat->p_irq, 0, n); memset(proc_stat->p_sirq, 0, n); - - n = proc_stat->ncpu * sizeof(unsigned long); - proc_stat->p_idle = (unsigned long *)malloc(n); - proc_stat->p_prev_idle = (unsigned long *)malloc(n); - memset(proc_stat->p_idle, 0, n); - memset(proc_stat->p_prev_idle, 0, n); } - /* * cpu 95379 4 20053 6502503 * 2.6 kernels have 3 additional fields * for wait, irq and soft_irq. */ - strcpy(fmt, "cpu %u %u %u %lu %u %u %u"); + strcpy(fmt, "cpu %llu %llu %llu %llu %llu %llu %llu"); n = sscanf((const char *)bufindex[0], fmt, &proc_stat->user, &proc_stat->nice, - &proc_stat->sys, &cur_idle, + &proc_stat->sys, &proc_stat->idle, &proc_stat->wait, &proc_stat->irq, &proc_stat->sirq); if (n == 4) proc_stat->wait = proc_stat->irq = proc_stat->sirq = 0; - if (cur_idle >= proc_stat->prev_idle) - proc_stat->idle += cur_idle - proc_stat->prev_idle; - else { - /* - * For 2.6.x kernels, idle counters always wrap at 32 bits. - * For 2.4 kernels, idle counters wrap at either 32 bits - * or 64 bits, depending on sizeof(long). - */ - if (have_long_idle_metric) - proc_stat->idle += cur_idle + - (ULONG_MAX - proc_stat->prev_idle); - else - proc_stat->idle += cur_idle + - (UINT_MAX - proc_stat->prev_idle); - } - proc_stat->prev_idle = cur_idle; - /* * per-cpu stats * e.g. cpu0 95379 4 20053 6502503 - * * 2.6 kernels have 3 additional fields * for wait, irq and soft_irq. */ @@ -223,36 +181,26 @@ refresh_proc_stat(proc_cpuinfo_t *proc_c proc_stat->p_sirq[0] = proc_stat->sirq; } else { + strcpy(fmt, "cpu%d %llu %llu %llu %llu %llu %llu %llu"); for (i=0; i < proc_stat->ncpu; i++) { for (j=0; j < nbufindex; j++) { if (strncmp("cpu", bufindex[j], 3) == 0 && isdigit(bufindex[j][3])) { int c; int cpunum = atoi(&bufindex[j][3]); if (cpunum >= 0 && cpunum < proc_stat->ncpu) { - n = sscanf(bufindex[j], "cpu%d %u %u %u %lu %u %u %u", &c, - &proc_stat->p_user[cpunum], &proc_stat->p_nice[cpunum], - &proc_stat->p_sys[cpunum], &cur_idle, - &proc_stat->p_wait[cpunum], &proc_stat->p_irq[cpunum], + n = sscanf(bufindex[j], fmt, &c, + &proc_stat->p_user[cpunum], + &proc_stat->p_nice[cpunum], + &proc_stat->p_sys[cpunum], + &proc_stat->p_idle[cpunum], + &proc_stat->p_wait[cpunum], + &proc_stat->p_irq[cpunum], &proc_stat->p_sirq[cpunum]); - if (n == 4) { proc_stat->p_wait[cpunum] = proc_stat->p_irq[cpunum] = proc_stat->p_sirq[cpunum] = 0; } - - if (cur_idle >= proc_stat->p_prev_idle[cpunum]) - proc_stat->p_idle[cpunum] += cur_idle - proc_stat->p_prev_idle[cpunum]; - else { - /* wrapped, see comment above */ - if (have_long_idle_metric) - proc_stat->p_idle[cpunum] += cur_idle + - (ULONG_MAX - proc_stat->p_prev_idle[cpunum]); - else - proc_stat->p_idle[cpunum] += cur_idle + - (UINT_MAX - proc_stat->p_prev_idle[cpunum]); - } - proc_stat->p_prev_idle[cpunum] = cur_idle; } } } @@ -292,10 +240,10 @@ refresh_proc_stat(proc_cpuinfo_t *proc_c * intr 32845463 24099228 2049 0 2 .... * (just export the first number, which is total interrupts) */ - strcpy(fmt, "intr %u"); + strcpy(fmt, "intr %llu"); for (j=0; j < nbufindex; j++) { if (strncmp(fmt, bufindex[j], 5) == 0) { - sscanf((const char *)bufindex[j], fmt, &proc_stat->intr[0]); + sscanf((const char *)bufindex[j], fmt, &proc_stat->intr); break; } } @@ -303,7 +251,7 @@ refresh_proc_stat(proc_cpuinfo_t *proc_c /* * ctxt 1733480 */ - strcpy(fmt, "ctxt %lu"); + strcpy(fmt, "ctxt %llu"); for (j=0; j < nbufindex; j++) { if (strncmp(fmt, bufindex[j], 5) == 0) { sscanf((const char *)bufindex[j], fmt, &proc_stat->ctxt); Index: devpcp/src/pmdas/linux/proc_stat.h =================================================================== --- devpcp.orig/src/pmdas/linux/proc_stat.h 2006-11-30 13:45:52.069182000 +1100 +++ devpcp/src/pmdas/linux/proc_stat.h 2006-11-30 13:46:09.742286500 +1100 @@ -24,18 +24,14 @@ #ident "$Id: proc_stat.h,v 1.13 2005/05/10 05:37:54 markgw Exp $" typedef struct { - unsigned int user, sys, nice, wait, irq, sirq; - unsigned long idle; - unsigned long prev_idle; + unsigned long long user, sys, nice, idle, wait, irq, sirq; unsigned int ncpu; - unsigned int *p_user, *p_sys, *p_nice, *p_wait, *p_irq, *p_sirq; - unsigned long *p_idle; - unsigned long *p_prev_idle; + unsigned long long *p_user, *p_sys, *p_nice, *p_idle, *p_wait, *p_irq, *p_sirq; unsigned int ndisk; - unsigned int page[2]; - unsigned int swap[2]; - unsigned int intr[65]; - unsigned long ctxt; + unsigned int page[2]; /* unused in 2.6, switched to /proc/vmstat */ + unsigned int swap[2]; /* unused in 2.6, switched to /proc/vmstat */ + unsigned long long intr; + unsigned long long ctxt; unsigned long btime; unsigned long processes; pmdaIndom *cpu_indom; --=-SgCiEPJ3shOJqjMQxkCZ-- From nscott@aconex.com Wed Feb 7 21:54:25 2007 Received: with ECARTIS (v1.0.0; list pcp); Wed, 07 Feb 2007 21:54:34 -0800 (PST) X-Spam-oss-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.0-pre1-r497472 Received: from postoffice.aconex.com (mail.app.aconex.com [203.89.192.138]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l185sNm7029867 for ; Wed, 7 Feb 2007 21:54:24 -0800 Received: from edge (unknown [203.89.192.141]) by postoffice.aconex.com (Postfix) with ESMTP id 2ADEEAAC655; Thu, 8 Feb 2007 16:39:20 +1100 (EST) Subject: [PATCH] Integrate with the Windows service manager From: Nathan Scott Reply-To: nscott@aconex.com To: Michael Newton Cc: pcp@oss.sgi.com Content-Type: multipart/mixed; boundary="=-eeedJHYr9cvCoafEyrx8" Organization: Aconex Date: Thu, 08 Feb 2007 16:55:09 +1100 Message-Id: <1170914109.26078.62.camel@edge> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-archive-position: 892 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: nscott@aconex.com Precedence: bulk X-list: pcp Content-Length: 8535 Lines: 271 --=-eeedJHYr9cvCoafEyrx8 Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi there, This little patch allows the PCP start/stop scripts to be used by the Windows service manager, so that PCP is started and stopped automatically on bootup and shutdown. Only affects the Windows PMDA... windows/GNUmakefile | 15 ++++- windows/pmcygrunsrv | 110 +++++++++++++++++++++++++++++++++++++ windows/pmcygwinserver.c | 68 ++++++++++++++++++++++ 3 files changed, 191 insertions(+), 2 deletions(-) cheers. -- Nathan --=-eeedJHYr9cvCoafEyrx8 Content-Disposition: attachment; filename=windows-services Content-Type: text/x-patch; name=windows-services; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: devpcp/src/pmdas/windows/GNUmakefile =================================================================== --- devpcp.orig/src/pmdas/windows/GNUmakefile 2007-02-08 13:09:36.351012000 +1100 +++ devpcp/src/pmdas/windows/GNUmakefile 2007-02-08 16:35:49.856307750 +1100 @@ -31,11 +31,13 @@ CFILES = pmda.c data.c HFILES = shm.h shim_pcp.h shim.h SHIM_CFILES = shim.c pdherr.c util.c init.c instance.c help.c fetch.c SHIM_OBJECTS = $(SHIM_CFILES:.c=.obj) +CYGWIN_CFILES = pmcygwinserver.c +CYGWIN_OBJECTS = $(CYGWIN_CFILES:.c=.o) LLDLIBS = -lpcp -lpcp_pmda LCFLAGS = -I. PMNS = pmns.disk pmns.kernel pmns.mem pmns.network \ pmns.sqlserver pmns.filesys pmns.hinv pmns.pmda -LSRCFILES = $(SHIM_CFILES) \ +LSRCFILES = $(SHIM_CFILES) $(CYGWIN_CFILES) pmcygrunsrv \ Install Remove $(PMNS) root README \ GNUmakefile.install shim.save \ match-counters show-all-ctrs.c show-all-ctrs.save \ @@ -66,12 +68,14 @@ ifeq "$(do_build)" "true" # C compiler gulfs CMDTARGET = pmdawindows.exe SHIMTARGET = check_shim +CYGWINTARGET = pmcygwinserver else CMDTARGET = SHIMTARGET = +CYGWINTARGET = endif -default_pcp default: $(LSRCFILES) $(CMDTARGET) $(SHIMTARGET) +default_pcp default: $(LSRCFILES) $(CMDTARGET) $(SHIMTARGET) $(CYGWINTARGET) SHIM_CC = '$(DDKROOT)\bin\x86\cl' SHIM_CFLAGS = -DPCP_DEBUG -DPCP_VERSION=\"$(PCP_VERSION)\" -DWIN32 /Od /Zi /I$(TOPDIR)/src/include /I'$(DDKROOT)\inc\$(MSPLATFORM)' /I'$(DDKROOT)\inc\crt' /I'$(SDKROOT)\include' @@ -108,10 +112,17 @@ install install_pcp: check_shim default $(INSTALL) -m 755 show-all-ctrs.exe $(CMDTARGET) $(PMDADIR) $(INSTALL) -m 644 GNUmakefile.install $(PMDADIR)/Makefile $(INSTALL) -m 644 README root $(PMNS) domain.h $(CFILES) $(PMDADIR) + $(INSTALL) -m 755 -d $(PCP_BIN_DIR) + $(INSTALL) -m 755 pmcygrunsrv $(PCP_BIN_DIR)/pmcygrunsrv + $(INSTALL) -m 755 -d $(PCP_SHARE_DIR)/bin + $(INSTALL) -m 755 $(CYGWINTARGET) $(PCP_SHARE_DIR)/bin/$(CYGWINTARGET) else install install_pcp: endif +pmcygwinserver.exe: $(CYGWIN_OBJECTS) + $(CCF) -o pmcygwinserver.exe $(LDFLAGS) $(CYGWIN_OBJECTS) + shim.exe: platform_defs.h $(SHIM_OBJECTS) rm -f shim.exe $(SHIM_LINK) /out:shim.exe $(SHIM_OBJECTS) user32.lib pdh.lib advapi32.lib $(SHIM_LINK_FLAGS) Index: devpcp/src/pmdas/windows/pmcygwinserver.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ devpcp/src/pmdas/windows/pmcygwinserver.c 2007-02-08 16:34:03.881684750 +1100 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007 Aconex, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include +#include +#include +#include +#include +#include +#include +#include + +char command[32]; +char *progname; +char *service; +char *timenow; +time_t now; + +void stop(int unused) +{ + (void)unused; + now = time(NULL); + timenow = ctime(&now); + timenow[strlen(timenow)-1] = '\0'; + snprintf(command, sizeof(command), "/etc/%s stop", service); + fprintf(stdout, "[%s] %s issuing \"%s\"\n", timenow, progname, command); + fflush(stdout); + + if (system(command) == 0) + exit(0); +} + +int main(int argc, char **argv) +{ + progname = basename(argv[0]); + if (argc != 2) { + fprintf(stderr, "%s: bad argument count (expected only 1, not %d).\n", + progname, argc - 1); + return 1; + } + service = argv[1]; + + now = time(NULL); + timenow = ctime(&now); + timenow[strlen(timenow)-1] = '\0'; + snprintf(command, sizeof(command), "/etc/%s start", service); + fprintf(stdout, "[%s] %s issuing \"%s\"\n", timenow, progname, command); + fflush(stdout); + + signal(SIGHUP, stop); + if (system(command) == 0) + pause(); + exit(1); +} Index: devpcp/src/pmdas/windows/pmcygrunsrv =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ devpcp/src/pmdas/windows/pmcygrunsrv 2007-02-08 16:37:56.152200750 +1100 @@ -0,0 +1,110 @@ +#!/bin/sh +# +# Copyright (c) 2007 Aconex. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# pmcygrunsrv: +# Manipulates one of the PCP "services" via cygrunsrv.exe. +# This script provides a dummy "service" executable which can +# be installed/removed/stopped/started/queried via the Windows +# (and Cygwin) services mechanisms. +# + +# Get standard environment +. /etc/pcp.env + +server="$PCP_SHARE_DIR/bin/pmcygwinserver" +user=Administrator +service=pcp # "pcp", "pmie" and "pmproxy" are valid + +verify_service() +{ + service="$1" + if [ "$1" != pcp -a "$1" != pmie -a "$1" != pmproxy ]; then + echo "Invalid service name: $service \(not pcp, pmie, or pmproxy\)" + exit 1 + fi +} + +report_service() +{ + service="$1" + cygrunsrv $verbose -Q $service 2>/dev/null + if [ $? -ne 0 ]; then + echo "Service : $service" + echo "Current State : Not installed" + fi +} + +usage() +{ + cat - < Installes a new service named . + -R Removes a service named . + -S Starts a service named . + -E Stops a service named . + -Q Queries a service named . + -L Lists services that have been installed. + +Services: + Valid are pcp, pmie, and pmproxy. +EOF + exit 1 +} + +install=false +remove=false +start=false +stop=false +query=false +list=false +verbose= + +while getopts I:R:S:E:Q:LVu:? c +do + case $c + in + I) verify_service $OPTARG; install=true ;; + R) verify_service $OPTARG; remove=true ;; + S) verify_service $OPTARG; start=true ;; + E) verify_service $OPTARG; stop=true ;; + Q) verify_service $OPTARG; query=true ;; + L) list=true ;; + V) verbose=-V ;; + u) user=$OPTARG ;; + *) usage ;; + esac +done +if $install ; then + cygrunsrv -I $service -u $user -n -o -y tcpip -s 1 -p $server -a $service \ + -1 /var/log/pcp/cygwin/$service.log -2 /var/log/pcp/cygwin/$service.log +elif $remove ; then + cygrunsrv -R $service +elif $query ; then + cygrunsrv -Q $service $verbose +elif $start ; then + cygrunsrv -S $service +elif $stop ; then + cygrunsrv -E $service +else + report_service pcp + report_service pmie + report_service pmproxy +fi +exit 0 --=-eeedJHYr9cvCoafEyrx8-- From nscott@aconex.com Mon Feb 12 19:46:46 2007 Received: with ECARTIS (v1.0.0; list pcp); Mon, 12 Feb 2007 19:46:55 -0800 (PST) X-Spam-oss-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.0-pre1-r497472 Received: from postoffice.aconex.com (mail.app.aconex.com [203.89.192.138]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l1D3khm7015160 for ; Mon, 12 Feb 2007 19:46:45 -0800 Received: from edge (unknown [203.89.192.141]) by postoffice.aconex.com (Postfix) with ESMTP id 41B20AAC400; Tue, 13 Feb 2007 14:30:57 +1100 (EST) Subject: [PATCH] Add page splits metric From: Nathan Scott Reply-To: nscott@aconex.com To: Michael Newton Cc: pcp@oss.sgi.com Content-Type: multipart/mixed; boundary="=-vPgbMi5vDxoOdef+xbzv" Organization: Aconex Date: Tue, 13 Feb 2007 14:48:13 +1100 Message-Id: <1171338494.26078.94.camel@edge> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-archive-position: 914 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: nscott@aconex.com Precedence: bulk X-list: pcp Content-Length: 1582 Lines: 50 --=-vPgbMi5vDxoOdef+xbzv Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi, This adds the "page splits" counter metric to the SQLServer set exported from the Windows PMDA. cheers. -- Nathan --=-vPgbMi5vDxoOdef+xbzv Content-Disposition: attachment; filename=sqlserver-locks-metrics Content-Type: text/x-patch; name=sqlserver-locks-metrics; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: devpcp/src/pmdas/windows/data.c =================================================================== --- devpcp.orig/src/pmdas/windows/data.c 2007-02-13 12:50:04.512089250 +1100 +++ devpcp/src/pmdas/windows/data.c 2007-02-13 13:00:58.564965000 +1100 @@ -681,7 +681,11 @@ static struct { PMDA_PMUNITS(0,0,0,0,0,0) }, Q_LDISK, M_NONE, "\\LogicalDisk(*/*#*)\\% Free Space" }, - +/* sqlserver.access.page_splits */ + { { PMDA_PMID(0,122), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_COUNTER, + PMDA_PMUNITS(0, 0, 1, 0, 0, PM_COUNT_ONE) + }, Q_SQLSERVER, M_NONE, "\\SQLServer:Access Methods\\Page Splits/sec" + }, }; int metrictab_sz = sizeof(metricdesc) / sizeof(metricdesc[0]); Index: devpcp/src/pmdas/windows/pmns.sqlserver =================================================================== --- devpcp.orig/src/pmdas/windows/pmns.sqlserver 2007-02-13 12:49:38.970493000 +1100 +++ devpcp/src/pmdas/windows/pmns.sqlserver 2007-02-13 12:59:55.937051000 +1100 @@ -118,4 +118,5 @@ sqlserver.access { full_scans WINDOWS:0:98 pages_allocated WINDOWS:0:99 table_lock_escalations WINDOWS:0:100 + page_splits WINDOWS:0:122 } --=-vPgbMi5vDxoOdef+xbzv--