diff --git a/man/man1/pmval.1 b/man/man1/pmval.1 index c9e2235..2fc1ef6 100644 --- a/man/man1/pmval.1 +++ b/man/man1/pmval.1 @@ -34,6 +34,7 @@ [\f3\-s\f1 \f2samples\f1] [\f3\-T\f1 \f2endtime\f1] [\f3\-t\f1 \f2interval\f1] +[\f3\-U\f1 \f2archive\f1] [\f3\-w\f1 \f2width\f1] [\f3\-Z\f1 \f2timezone\f1] \f2metricname\f1 @@ -67,7 +68,9 @@ Unless directed to another host by the option, or to an archive by the .B \-a -option, +or +.B \-U +options, .B pmval will contact the Performance Metrics Collector Daemon (PMCD) on the local host to obtain the required information. @@ -232,6 +235,26 @@ argument follows the syntax described in and in the simplest form may be an unsigned integer (the implied units in this case are seconds). .TP +.B \-U +Performance metric values are retrieved from the Performance Co-Pilot (PCP) +archive log file identified by the base name +.IR archive , +although unlike +.B \-a +every recorded value in the archive for the selected metric +and instances is reported (so no interpolation mode, and the sample +interval (\c +.B \-t +option) is ignored. +.RS +5n +.PP +At most one of the options +.B \-a +and +.B \-U +may be specified. +.RE +.TP .B \-w Set the width of each column of output to be .I width @@ -261,6 +284,8 @@ the source of the performance metrics, as identified via either the .B \-h or .B \-a +of +.B \-U options. .PP The following symbols may occasionally appear, in place of a metric value, in diff --git a/src/pmval/pmval.c b/src/pmval/pmval.c index 61bb835..0d7707f 100644 --- a/src/pmval/pmval.c +++ b/src/pmval/pmval.c @@ -433,7 +433,7 @@ printhdr(Context *x, long smpls, struct timeval delta, struct timeval first) } putchar('\n'); - /* sample count */ + /* sample count and interval */ if (smpls == ALL_SAMPLES) printf("samples: all\n"); else printf("samples: %ld\n", smpls); if (smpls != ALL_SAMPLES && smpls > 1 && @@ -1126,16 +1126,48 @@ getargs(int argc, /* in - command line argument count */ *smpls = (long)((__pmtimevalToReal(&last) - __pmtimevalToReal(posn)) / __pmtimevalToReal(delta)); + if (*smpls < 0) /* if end is before start, no samples thanks */ - if (*smpls < 0) *smpls = 0; - /* counters require 2 samples to produce reported sample */ - if (*smpls > 0 && cntxt->desc.sem != PM_SEM_COUNTER) + *smpls = 0; + else { + /* + * p stands for posn + * + p + p+delta + p+2*delta + p+3*delta + last + * | | | | | | + * +-----------+-----------+-----------+-- ...... ----+---+---> time + * 1 2 3 smpls + * + * So we will perform smpls+1 fetches ... the number of reported + * values cannot be determined as it is usually (but not always + * thanks to interpolation mode in archives) one less for + * PM_SEM_COUNTER metrics. + * + * samples: as reported in the header output is the number + * of fetches to be attempted. + */ (*smpls)++; + } #ifdef PCP_DEBUG - if (pmDebug & DBG_TRACE_APPL0) - fprintf(stderr, "getargs: first=%.6f posn=%.6f last=%.6f\ngetargs: delta=%.6f samples=%ld\n", - __pmtimevalToReal(&first), __pmtimevalToReal(posn), - __pmtimevalToReal(&last), __pmtimevalToReal(delta), *smpls); + if (pmDebug & DBG_TRACE_APPL0) { + char tbfr[26]; + char *tp; + fprintf(stderr, "getargs: first=%.6f", __pmtimevalToReal(&first)); + tp = pmCtime((time_t *)&first.tv_sec, tbfr); + /* + * tp -> Ddd Mmm DD HH:MM:SS YYYY\n + * 0 4 8 1 1 2 2 2 + * 1 8 0 3 4 + */ + fprintf(stderr, "[%8.8s]\n", &tp[11]); + fprintf(stderr, "getargs: posn=%.6f", __pmtimevalToReal(posn)); + tp = pmCtime((time_t *)&posn->tv_sec, tbfr); + fprintf(stderr, "[%8.8s]\n", &tp[11]); + fprintf(stderr, "getargs: last=%.6f", __pmtimevalToReal(&last)); + tp = pmCtime((time_t *)&last.tv_sec, tbfr); + fprintf(stderr, "[%8.8s]\n", &tp[11]); + fprintf(stderr, "getargs: delta=%.6f samples=%ld\n", + __pmtimevalToReal(delta), *smpls); + } #endif }