Attached to this is a patch file against the 2.3.2-4 sources which
changes two things:
1. It adds a -q and -Q flag to pmval which suppresses the headers &c
it prints - -q suppresses headers, -Q suppresses everything
including the instance names. I'm not sure if this is really
useful as I've discovered that pmie can do the same thing more
flexibly.
2. There are some changes to the disk/partition detection which I
think make it work more reliably. In particular it now looks for
things with `/' chars in, and assumes they are either cntndn
(disks) or cntndnpn (partition) names. if it doesn't find a slash
it assumes old-fashioned xx0 (disk) or xx0a (partition) names.
This is still far from perfect, but it works in more cases I think.
--tim
Index: pcp-2.3.2/man/man1/pmval.1
===================================================================
RCS file:
/home/buildboxcvs/build_box/linuxboot/all_boxes/pcp/pcp-2.3.2/man/man1/pmval.1,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** pcp-2.3.2/man/man1/pmval.1 18 Dec 2003 10:42:17 -0000 1.1.1.1
--- pcp-2.3.2/man/man1/pmval.1 22 Dec 2003 13:00:55 -0000 1.2
***************
*** 31,37 ****
.\"
.\" http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
.\"
! .\" $Id: pmval.1,v 1.1.1.1 2003/12/18 10:42:17 builder Exp $
.ie \(.g \{\
.\" ... groff (hack for khelpcenter, man2html, etc.)
.TH PMVAL 1 "SGI" "Performance Co-Pilot"
--- 31,37 ----
.\"
.\" http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
.\"
! .\" $Id: pmval.1,v 1.2 2003/12/22 13:00:55 builder Exp $
.ie \(.g \{\
.\" ... groff (hack for khelpcenter, man2html, etc.)
.TH PMVAL 1 "SGI" "Performance Co-Pilot"
***************
*** 50,56 ****
.\" arguments use .I or \f2
.SH SYNOPSIS
\f3pmval\f1
! [\f3\-dgrz\f1]
[\f3\-A\f1 \f2align\f1]
[\f3\-a\f1 \f2archive\f1]
[\f3\-h\f1 \f2host\f1]
--- 50,56 ----
.\" arguments use .I or \f2
.SH SYNOPSIS
\f3pmval\f1
! [\f3\-dgrqz\f1]
[\f3\-A\f1 \f2align\f1]
[\f3\-a\f1 \f2archive\f1]
[\f3\-h\f1 \f2host\f1]
***************
*** 184,189 ****
--- 184,200 ----
with synchronized time control.
.BR Note :
This option is suppored on Irix only.
+ .TP
+ .B \-q
+ Be somewhat quiet: don't print the header, but print instance names
+ before records. This is useful if you're feeding the output into a
+ script or something like that.
+ .TP
+ .B \-Q
+ Be very quiet: don't print the header, or instance names before
+ printing records. This is useful if you're feeding the output into a
+ script or something like that. For both of the quietness options some
+ spurious blank lines are still printed.
.TP
.B \-r
Print raw values for cumulative counter metrics. Normally cumulative counter
Index: pcp-2.3.2/src/pmdas/linux/proc_partitions.c
===================================================================
RCS file:
/home/buildboxcvs/build_box/linuxboot/all_boxes/pcp/pcp-2.3.2/src/pmdas/linux/proc_partitions.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -c -r1.1.1.1 -r1.3
*** pcp-2.3.2/src/pmdas/linux/proc_partitions.c 18 Dec 2003 10:42:17 -0000
1.1.1.1
--- pcp-2.3.2/src/pmdas/linux/proc_partitions.c 23 Dec 2003 12:20:33 -0000
1.3
***************
*** 32,38 ****
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
! #ident "$Id: proc_partitions.c,v 1.1.1.1 2003/12/18 10:42:17 builder Exp $"
#include <stdio.h>
#include <errno.h>
--- 32,38 ----
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
! #ident "$Id: proc_partitions.c,v 1.3 2003/12/23 12:20:33 builder Exp $"
#include <stdio.h>
#include <errno.h>
***************
*** 60,76 ****
*
* Mylex raid disks are named e.g. rd/c0d0 or dac960/c0d0
* Mylex raid partitions are named e.g. rd/c0d0p1 or dac960/c0d0p1
*/
int
_pm_ispartition(char *dname)
{
! int ret = 0;
! if (strncmp(dname, "rd/", 3) == 0 || strncmp(dname, "dac960/", 7) == 0)
! ret = strrchr(dname, 'p') != NULL;
! else
! /* default test : partition names end in a digit */
! ret = isdigit(dname[strlen(dname)-1]);
! return ret;
}
/*
--- 60,89 ----
*
* Mylex raid disks are named e.g. rd/c0d0 or dac960/c0d0
* Mylex raid partitions are named e.g. rd/c0d0p1 or dac960/c0d0p1
+ *
+ * What this now tries to do is be a bit smart, and guess that names
+ * with slashes in are of the form .../c0t0d0[p0], and ones without
+ * are good old 19th century device names like xx0 or xx0a.
*/
int
_pm_ispartition(char *dname)
{
! int m = strlen(dname) - 1;
! if (strchr(dname, '/')) {
! /* looking at something like foo/x, and we hope x ends p<n>, for
! * a partition, or not for a disk.
! */
! int p;
! for (p = m; p > 0 && isdigit(dname[p]); p--)
! ;
! if (p == m)
! /* name had no trailing digits. Wildly guess a disk. */
! return 1;
! else
! return (dname[p] == 'p'? 1 : 0);
! } else
! /* default test : partition names end in a digit */
! return (isdigit(dname[m]));
}
/*
Index: pcp-2.3.2/src/pmval/pmval.c
===================================================================
RCS file:
/home/buildboxcvs/build_box/linuxboot/all_boxes/pcp/pcp-2.3.2/src/pmval/pmval.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** pcp-2.3.2/src/pmval/pmval.c 18 Dec 2003 10:42:16 -0000 1.1.1.1
--- pcp-2.3.2/src/pmval/pmval.c 22 Dec 2003 13:00:55 -0000 1.2
***************
*** 33,39 ****
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
! #ident "$Id: pmval.c,v 1.1.1.1 2003/12/18 10:42:16 builder Exp $"
#include <stdio.h>
#include <errno.h>
--- 33,39 ----
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
! #ident "$Id: pmval.c,v 1.2 2003/12/22 13:00:55 builder Exp $"
#include <stdio.h>
#include <errno.h>
***************
*** 82,87 ****
--- 82,89 ----
#ifdef __sgi
" -p port port name for connection to existing time control\n"
#endif
+ " -q don't print headers, but print instance names\n"
+ " -Q don't print any headers at all\n"
" -r output raw counter values\n"
" -S starttime start of the time window\n"
" -s samples terminate after this many samples\n"
***************
*** 132,137 ****
--- 134,140 ----
static char *rpt_tz_label = NULL;
static int pauseFlag = 0;
static int raw = 0;
+ static int quiet = 0; /* be quiet */
static int ahtype = PM_CONTEXT_HOST; /* archive or host? */
static int amode = PM_MODE_INTERP; /* archive scan mode */
static char local[] = "localhost";
***************
*** 1031,1037 ****
*cols = 0;
/* extract command-line arguments */
! while ((c = getopt(argc, argv, "A:a:D:dgh:i:n:O:p:rs:S:t:T:U:w:zZ:?")) !=
EOF) {
switch (c) {
case 'A': /* sample alignment */
--- 1034,1040 ----
*cols = 0;
/* extract command-line arguments */
! while ((c = getopt(argc, argv, "A:a:D:dgh:i:n:O:p:qQrs:S:t:T:U:w:zZ:?"))
!= EOF) {
switch (c) {
case 'A': /* sample alignment */
***************
*** 1119,1124 ****
--- 1122,1135 ----
break;
#endif
+ case 'q':
+ quiet = 1; /* be quiet */
+ break;
+
+ case 'Q':
+ quiet = 2; /* be very quiet */
+ break;
+
case 'r': /* raw */
raw = 1;
break;
***************
*** 1461,1467 ****
#endif
if (cols <= 0) cols = howide(cntxt.desc.type);
! printhdr(&cntxt, smpls, delta, now);
/* wait till time for first sample */
if (archive == NULL )
--- 1472,1478 ----
#endif
if (cols <= 0) cols = howide(cntxt.desc.type);
! if (!quiet) printhdr(&cntxt, smpls, delta, now);
/* wait till time for first sample */
if (archive == NULL )
***************
*** 1574,1580 ****
if ((idx2 = getvals(&cntxt, &rslt2)) >= 0) {
/* first-time success */
first = 0;
! if (cntxt.desc.indom != PM_INDOM_NULL)
printlabels(&cntxt, cols);
if (raw || (cntxt.desc.sem != PM_SEM_COUNTER)) {
if (gui || archive != NULL)
--- 1585,1593 ----
if ((idx2 = getvals(&cntxt, &rslt2)) >= 0) {
/* first-time success */
first = 0;
! /* This quietness is not enough to prevent some spurious
! blank lines getting in. Damn! */
! if ((quiet < 2) && (cntxt.desc.indom != PM_INDOM_NULL))
printlabels(&cntxt, cols);
if (raw || (cntxt.desc.sem != PM_SEM_COUNTER)) {
if (gui || archive != NULL)
***************
*** 1631,1637 ****
free(cntxt.inames);
free(cntxt.ipairs);
initinsts(&cntxt);
! printlabels(&cntxt, cols);
}
/* print values */
--- 1644,1650 ----
free(cntxt.inames);
free(cntxt.ipairs);
initinsts(&cntxt);
! if (quiet < 2) printlabels(&cntxt, cols);
}
/* print values */
***************
*** 1640,1645 ****
--- 1653,1659 ----
if (raw || (cntxt.desc.sem != PM_SEM_COUNTER))
printvals(&cntxt, rslt1->vset[idx1], cols);
else
+
printrates(&cntxt, rslt1->vset[idx1], rslt1->timestamp,
rslt2->vset[idx2], rslt2->timestamp, cols);
|