Skip to content

Commit

Permalink
Merge branch 'main' of ../pcp
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcdonell committed Jul 22, 2024
2 parents 828d3f7 + 2e0ece7 commit 60be755
Show file tree
Hide file tree
Showing 17 changed files with 913 additions and 690 deletions.
3 changes: 2 additions & 1 deletion qa/1151
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ echo "QA output created by $seq"

. ./common.bcc

$sudo rm -rf $tmp.* $seq.full

_pmdabcc_check
_pmdabcc_require_kernel_version 4 7
_java_check

status=1 # failure is the default!
signal=$PCP_BINADM_DIR/pmsignal
$sudo rm -rf $tmp.* $seq.full

# Launch a Java test program
cd java
Expand Down
1,341 changes: 669 additions & 672 deletions qa/1428.out

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion qa/1525
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ which pmview >/dev/null 2>&1 || _notrun "No pmview binary installed"
status=0 # success is the default!
trap "_cleanup_qt; exit \$status" 0 1 2 3 15

# $tmp.ctrls line is pending a TODO fix for osvis and strange
# error messages on vm11
#
_filter()
{
_filter_qt \
| sed \
-e "s@$tmp@TMP@g" \
-e '/cannot open/s@/tmp/[0-9][0-9]*[email protected]@' \
-e '/cannot open/{
s@/tmp/[0-9][0-9]*[email protected]@
s@1: /usr/bin/osvis:@1:@
}' \
# end
}

Expand Down
11 changes: 11 additions & 0 deletions qa/1619
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ _filter()
# real QA test starts here
inode0=`ls -i $PCP_PMCDCONF_PATH | awk '{ print $1 }'`
echo Inode0: $inode0 >> $here/$seq.full
cp $PCP_PMCDCONF_PATH $tmp.save
cat $PCP_PMCDCONF_PATH >> $here/$seq.full

_service pmcd restart 2>&1 | _filter_pcp_stop | _filter_pcp_start
_wait_for_pmcd
_wait_for_pmlogger

inode1=`ls -i $PCP_PMCDCONF_PATH | awk '{ print $1 }'`
echo Inode1: $inode1 >> $here/$seq.full
cat $PCP_PMCDCONF_PATH >> $here/$seq.full

echo "Comparing pmcd.conf inode numbers"
if test $inode0 -eq $inode1
Expand All @@ -51,5 +54,13 @@ else
status=1
fi

if diff $tmp.save $PCP_PMCDCONF_PATH
then
:
else
echo "Arrgh ... $PCP_PMCDONF_PATH changed"
status=1
fi

# all done
exit
14 changes: 13 additions & 1 deletion qa/admin/list-packages
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ _usage()
echo >&2 " -c check packing list"
echo >&2 " -i tag include only lines with a tag"
echo >&2 " -m list only missing packages"
echo >&2 " -n report my packing-list file and quit"
echo >&2 " -v verbose (debugging)"
echo >&2 " -V version override platform version"
echo >&2 " -x tag exclude lines with a tag"
Expand Down Expand Up @@ -264,7 +265,8 @@ include=''
exclude=''
missing=false
check=false
while getopts 'A:cD:i:mvV:x:?' p
nflag=false
while getopts 'A:cD:i:mnvV:x:?' p
do
case "$p"
in
Expand All @@ -288,6 +290,9 @@ do
m) missing=true
;;

n) nflag=true
;;

v) if $verbose
then
very_verbose=true
Expand Down Expand Up @@ -406,6 +411,13 @@ else
exit
fi

if $nflag
then
echo "$home/package-lists/${distro}+${version}+${arch}"
status=0
exit
fi

if [ -n "$exclude" ]
then
$very_verbose && [ -n "$exclude" ] && echo >&2 "Excluding tags:$exclude"
Expand Down
3 changes: 2 additions & 1 deletion qa/admin/package-lists/CentOS+Stream8+x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ grep
iproute
httpd
initscripts
java-latest-openjdk-headless
# -latest- (aka 22) and -21- don't have USDT support, so go with -17-
java-17-openjdk-headless
libbpf
libicu-devel
libpfm-devel
Expand Down
Binary file modified qa/archives/daily_report.0
Binary file not shown.
Binary file modified qa/archives/daily_report.index
Binary file not shown.
Binary file modified qa/archives/daily_report.meta
Binary file not shown.
7 changes: 7 additions & 0 deletions qa/archives/mk.daily_report
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
# a bit of a work out for the pmrep .conf files: sar.conf, vmstat.conf
# and numa.conf
#
# Best to run this on a recent Fedora (e.g. 40 as of Jul 2024) so all
# of the metrics here are available, and with some concurrent activity
# for abouth 20 seconds, e.g. I rebuild all the QA applications:
# $ cd src/pcp/qa/src
# $ make clean
# $ make
#

tmp=/var/tmp/mk-daily-$$
trap "rm -f $tmp.*; exit 0" 0 1 2 3 15
Expand Down
35 changes: 23 additions & 12 deletions qa/common.bcc
Original file line number Diff line number Diff line change
Expand Up @@ -211,20 +211,31 @@ _java_check()
/etc/alternatives/jre/lib/$__java_machine/server \
/usr/lib/jvm/java-${__java_major}-openjdk-$__java_machine/lib/server \
/usr/lib/jvm/java-${__java_version}-openjdk/jre/lib/$__java_machine/server \
/usr/lib/jvm/java-${__java_major}-openjdk-$__java_machine/jre/lib/$__java_machine/server
/usr/lib/jvm/java-${__java_major}-openjdk-$__java_machine/jre/lib/$__java_machine/server \
/usr/lib/jvm/jre/lib/server \
/usr/lib/jvm/jre-openjdk/lib/server \
/usr/lib/jvm/jre-${__java_major}/lib/server \
/usr/lib/jvm/jre-${__java_major}-openjdk/lib/server
do
[ -f "$__path/libjvm.$DSO_SUFFIX" ] && __jvm_path="$__path/libjvm.$DSO_SUFFIX"
done

[ -z "$__jvm_path" ] && _notrun "libjvm.$DSO_SUFFIX not found"

for __tplistcmd in /usr/share/bcc/tools/tplist tplist-bpfcc tplist
do
which $__tplistcmd >/dev/null 2>&1 && \
__probes=$($__tplistcmd -l $__jvm_path 2>/dev/null | grep thread__start)
[ -n "$__probes" ] && return 0
[ -f "$__path/libjvm.$DSO_SUFFIX" ] || continue
__jvm_path="$__path/libjvm.$DSO_SUFFIX"
echo "trying \$__jvm_path=$__jvm_path for USDT probes" >>$here/$seq.full
for __tplistcmd in /usr/share/bcc/tools/tplist tplist-bpfcc tplist
do
which $__tplistcmd >/dev/null 2>&1 && \
__probes=$($__tplistcmd -l $__jvm_path 2>/dev/null \
| grep thread \
| tee -a $here/$seq.full \
| grep thread__start)
if [ -n "$__probes" ]
then
echo "success with \$__jvm_path=$__jvm_path" >>$here/$seq.full
return 0
fi
done
done
_notrun "No Java USDT probes available"
[ -z "$__jvm_path" ] && _notrun "no libjvm.$DSO_SUFFIX not found"
_notrun "No Java USDT probes available in any libjvm.$DSO_SUFFIX"
}

_python_probe_check()
Expand Down
7 changes: 7 additions & 0 deletions src/pmdas/linux/help
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ of traffic over different paths. See also multipathd(1), where the
same ID strings (WWID) are used to identify different paths to each
physical device.

@ hinv.disk.ctlr physical disk device controller
The disk controller is extracted from /sys/devices/pci0000:00/0000:<ctlr>.
Multiple disks may share the same controller.

@ hinv.disk.model physical disk device model
The disk model is extracted from /sys/devices/.../model.

@ disk.dev.avactive per-disk count of active time
Counts the number of milliseconds for which at least one I/O is in
progress for each device.
Expand Down
11 changes: 11 additions & 0 deletions src/pmdas/linux/pmda.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* for more details.
*
* pmDebugOption:
* appl1 disk-related metrics
* appl8 filesys metrics
* libpmda historic "everything else" diagnostics
*/
Expand Down Expand Up @@ -2597,6 +2598,16 @@ static pmdaMetric metrictab[] = {
{ PMDA_PMID(CLUSTER_STAT,104), PM_TYPE_U64, PM_INDOM_NULL, PM_SEM_INSTANT,
PMDA_PMUNITS(0,0,0,0,0,0) }, },

/* hinv.disk.ctlr */
{ NULL,
{ PMDA_PMID(CLUSTER_STAT,105), PM_TYPE_STRING, DISK_INDOM, PM_SEM_DISCRETE,
PMDA_PMUNITS(0,0,0,0,0,0) }, },

/* hinv.disk.model */
{ NULL,
{ PMDA_PMID(CLUSTER_STAT,106), PM_TYPE_STRING, DISK_INDOM, PM_SEM_DISCRETE,
PMDA_PMUNITS(0,0,0,0,0,0) }, },

/*
* zram IO cluster
*/
Expand Down
148 changes: 148 additions & 0 deletions src/pmdas/linux/proc_partitions.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,8 @@ static pmID disk_metric_table[] = {
/* disk.all.flush_rawactive */ PMDA_PMID(CLUSTER_STAT,102),
/* hinv.map.scsi_id */ PMDA_PMID(CLUSTER_STAT,103),
/* disk.all.inflight */ PMDA_PMID(CLUSTER_STAT,104),
/* hinv.disk.ctlr */ PMDA_PMID(CLUSTER_STAT,105),
/* hinv.disk.model */ PMDA_PMID(CLUSTER_STAT,106),

/* disk.partitions.read */ PMDA_PMID(CLUSTER_PARTITIONS,0),
/* disk.partitions.write */ PMDA_PMID(CLUSTER_PARTITIONS,1),
Expand Down Expand Up @@ -1066,6 +1068,138 @@ _pm_ioscheduler(const char *device)
return "unknown";
}

/*
* Get controller (name) for a specific disk
*/
char *
get_disk_ctlr(char *name)
{
ssize_t size;
int want;
char *part;
char path[MAXPATHLEN];
char link[MAXPATHLEN];
char *ctlr;

pmsprintf(path, sizeof(path), "%s/sys/block/%s", linux_statspath, name);
if ((size = readlink(path, link, sizeof(link)-1)) < 0) {
if (pmDebugOptions.appl1) {
fprintf(stderr, "get_disk_ctlr(%s,...): readlink(%s,...) failed: %" FMT_INT64, name, path, (int64_t)size);
if (size < 0)
fprintf(stderr, ": %s", pmErrStr(-oserror()));
fputc('\n', stderr);
}
return NULL;
}
link[size] = '\0';
/*
* .../pci0000:00/0000:00:10.0/.../sdd
* ^^^^^^^ controlller id as per lspci
* ^^^ disk name as per indom
*/
part = strtok(link, "/");
want = 0;
while (part != NULL) {
if (strcmp(part, "pci0000:00") == 0) {
/*
* this is the only PCI prefix we are sure about
* TODO - other possibilities here?
*/
want = 1;
}
else if (want == 1) {
if (strncmp(part, "0000:", 5) == 0) {
ctlr = strdup(&part[5]);
if (ctlr == NULL)
pmNoMem("get_disk_ctlr: ctlr", strlen(&part[5])+1, PM_RECOV_ERR);
return ctlr;
}
else {
/* TODO - prefixes other than 0000: here? */
if (pmDebugOptions.appl1) {
fprintf(stderr, "get_disk_ctlr(%s,...): expected 0000: got %5.5s from link %s\n", name, part, link);
}
return NULL;
}
}
part = strtok(NULL, "/");
}

if (pmDebugOptions.appl1)
fprintf(stderr, "get_disk_ctlr(%s,...): link=%s not expected\n", name, link);
return NULL;
}

/*
* Get model for a specific disk
*/
char *
get_disk_model(char *name)
{
ssize_t size;
int fd;
char *part;
char path[MAXPATHLEN];
char link[MAXPATHLEN];
char duplink[MAXPATHLEN];
char *model;

pmsprintf(path, sizeof(path), "%s/sys/block/%s", linux_statspath, name);
if ((size = readlink(path, link, sizeof(link)-1)) < 0) {
if (pmDebugOptions.appl1) {
fprintf(stderr, "get_disk_model(%s,...): readlink(%s,...) failed: %" FMT_INT64, name, path, (int64_t)size);
if (size < 0)
fprintf(stderr, ": %s", pmErrStr(-oserror()));
fputc('\n', stderr);
}
return NULL;
}
link[size] = '\0';
strcpy(duplink, link);
model = NULL;
part = strtok(link, "/");
while (part != NULL) {
if (strcmp(part, "block") == 0) {
/*
* .../pci0000:00/.../a:b:c:d/block/sdd
* becomes
* .../pci0000:00/.../a:b:c:d/model
*/
int offset;
offset = part - link - 1;
duplink[offset] = '\0';
pmsprintf(path, sizeof(path), "%s/sys/block/%s/model", linux_statspath, duplink);
if ((fd = open(path, O_RDONLY)) >= 0) {
char buf[1024];
size = read(fd, buf, sizeof(buf)-1);
if (size > 0) {
buf[size-1] = '\0';
model = strdup(buf);
// TODO pmMem
return model;
}
else {
if (pmDebugOptions.appl1) {
fprintf(stderr, "get_disk_model(%s,...): read(%s): %" FMT_INT64 "\n", name, path, (int64_t)size);
}
return NULL;
}
}
else {
if (pmDebugOptions.appl1) {
fprintf(stderr, "get_disk_model(%s,...): open(%s,...) failed: %s\n", name, path, pmErrStr(-oserror()));
}
return NULL;
}
}
part = strtok(NULL, "/");
}

if (pmDebugOptions.appl1)
fprintf(stderr, "get_disk_model(%s,...): link=%s not expected\n", name, link);
return NULL;
}

int
proc_partitions_fetch(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom)
{
Expand Down Expand Up @@ -1225,6 +1359,20 @@ proc_partitions_fetch(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom)
return PM_ERR_INST;
atom->cp = _pm_scsi_id(p->namebuf);
break;
case 105: /* hinv.disk.ctlr */
if (p == NULL)
return PM_ERR_INST;
if (p->ctlr == NULL)
p->ctlr = get_disk_ctlr(p->namebuf);
atom->cp = p->ctlr;
break;
case 106: /* hinv.disk.model */
if (p == NULL)
return PM_ERR_INST;
if (p->model == NULL)
p->model = get_disk_model(p->namebuf);
atom->cp = p->model;
break;
default:
/* disk.all.* is a singular instance domain */
atom->ull = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/pmdas/linux/proc_partitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ typedef struct {
char *dmname; /* symlink from /dev/mapper, else NULL */
char *mdname; /* symlink from /dev/md, else NULL */
char *wwidname; /* wwid of sd path, else NULL */
char *ctlr; /* from /sys/block symlink, else NULL */
char *model; /* from /sys/devices/..., else NULL */
zram_stat_t *zram;
unsigned long long rd_ios;
unsigned long long rd_merges;
Expand Down
Loading

0 comments on commit 60be755

Please sign in to comment.