Skip to content

Commit f7aaf6a

Browse files
committed
Merge branch 'main' of github.com:performancecopilot/pcp
2 parents 5185515 + 26be7db commit f7aaf6a

File tree

19 files changed

+1158
-630
lines changed

19 files changed

+1158
-630
lines changed

qa/1605

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
# PCP QA Test No. 1605
3+
# pmGetOpt - mem leak from ambiguity handling of long options
4+
#
5+
# Copyright (c) 2025 Ken McDonell. All Rights Reserved.
6+
#
7+
8+
if [ $# -eq 0 ]
9+
then
10+
seq=`basename $0`
11+
echo "QA output created by $seq"
12+
else
13+
# use $seq from caller, unless not set
14+
[ -n "$seq" ] || seq=`basename $0`
15+
echo "QA output created by `basename $0` $*"
16+
fi
17+
18+
# get standard environment, filters and checks
19+
. ./common.product
20+
. ./common.filter
21+
. ./common.check
22+
23+
_check_valgrind
24+
25+
_cleanup()
26+
{
27+
cd $here
28+
$sudo rm -rf $tmp $tmp.*
29+
}
30+
31+
status=0 # success is the default!
32+
trap "_cleanup; exit \$status" 0 1 2 3 15
33+
34+
# real QA test starts here
35+
_run_valgrind pminfo --h
36+
37+
# success, all done
38+
exit

qa/1605.out

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
QA output created by 1605
2+
=== std out ===
3+
=== std err ===
4+
pminfo: option '--h' is ambiguous; possibilities: '--host' '--helptext' '--help' '--hostzone'
5+
Usage: pminfo [options] [metricname | pmid | indom]...
6+
7+
General options:
8+
-a FILE, --archive=FILE
9+
metrics source is a PCP archive
10+
-D DBG, --debug=DBG set debug options, see pmdbg(1)
11+
-h HOST, --host=HOST metrics source is PMCD on host
12+
--container=NAME specify an individual container to be queried
13+
-L, --local-PMDA metrics source is local connection to a PMDA
14+
-K SPEC, --spec-local=SPEC
15+
optional additional PMDA spec for local connection
16+
-n FILE, --namespace=FILE
17+
use an alternative PMNS
18+
-N FILE, --uniqnames=FILE
19+
like -n but only one name allowed for each PMID
20+
-O TIME, --origin=TIME
21+
initial sample time within the time window
22+
-Z TZ, --timezone=TZ set reporting timezone
23+
-z, --hostzone set reporting timezone to local time of metrics source
24+
-V, --version display version number and exit
25+
-?, --help show this usage message and exit
26+
27+
Protocol options:
28+
-b N, --batch=N fetch N metrics at a time for -f and -v [128]
29+
-d, --desc get and print metric description
30+
-f, --fetch fetch and print values for all instances
31+
-F, --fetchall fetch and print values for non-enumerable indoms
32+
-I, --fullindom print InDom in verbose format
33+
-l, --labels print InDom, metric and instance labels
34+
-m, --pmid print PMID
35+
-M, --fullpmid print PMID in verbose format
36+
-s, --series print source, metric, instance series identifiers
37+
-t, --oneline get and display (terse) oneline text
38+
-T, --helptext get and display (verbose) help text
39+
40+
Metrics options:
41+
-c FILE, --derived=FILE
42+
load global derived metric definitions from FILE(s)
43+
-r name=expr, --register=name=expr
44+
register a per-context derived metric
45+
-x, --events unpack and report on any fetched event records
46+
-v, --verify verify mode, be quiet and only report errors
47+
=== filtered valgrind report ===
48+
Memcheck, a memory error detector
49+
Command: pminfo --h
50+
LEAK SUMMARY:
51+
definitely lost: 0 bytes in 0 blocks
52+
indirectly lost: 0 bytes in 0 blocks
53+
ERROR SUMMARY: 0 errors from 0 contexts ...

qa/1615

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ _cleanup()
3535
_restore_config $PCP_SYSCONF_DIR/pmproxy/pmproxy.conf
3636

3737
[ -d $archive_path ] && $sudo rm -fr $archive_path
38+
if [ -f $PCP_LOG_DIR/pmproxy/pmproxy.log ]
39+
then
40+
cat $PCP_LOG_DIR/pmproxy/pmproxy.log >>$seq_full
41+
else
42+
echo "Arrg, $PCP_LOG_DIR/pmproxy/pmproxy.log missing"
43+
fi
3844
if $pmproxy_was_running
3945
then
4046
echo "Restart pmproxy ..." >>$seq_full

qa/1617

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ pmseries -c $tmp.conf -m | _filter_metrics
166166
# valgrind takes awhile to shutdown too
167167
_wait_process_end $pid
168168
echo "=== valgrind stdout ===" | tee -a $seq_full
169-
cat $tmp.valout | _filter_valgrind
169+
cat $tmp.valout | tee -a $seq_full | _filter_valgrind
170170

171171
echo "=== valgrind stderr ===" | tee -a $seq_full
172-
cat $tmp.valerr | _filter_pmproxy_log | grep -v "Cannot connect to key server" | _filter_pmproxy_port
172+
cat $tmp.valerr | tee -a $seq_full | _filter_pmproxy_log | grep -v "Cannot connect to key server" | _filter_pmproxy_port
173173

174174
# success, all done
175175
exit

qa/761

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ root_cleanup()
3939
[ -f $tmp.conf.backup ] && $sudo cp $tmp.conf.backup $PCP_DIR/etc/pcp.conf
4040
_restore_pmda_install root || _exit 1
4141
rm -f $here/$seq.test-lxc-info.sh
42+
rm -rf $tmp.* $tmp
4243
}
4344

4445
# do metrics one at a time, map all internal instance ids to N and sort

qa/801

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ perl -e "use PCP::PMDA" >/dev/null 2>&1
1919
[ $? -eq 0 ] || _notrun "perl PCP::PMDA module not installed"
2020

2121
status=1 # failure is the default!
22-
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
22+
trap "cd $here; rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
2323

2424
#setup the tmp proc file system for older config
2525
pmdanetfilter_prepare()

qa/864

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ if grep 'collectl version' $tmp.out >/dev/null
2323
then
2424
:
2525
else
26+
rm -f $tmp.out
2627
_notrun "pcp-collectl not installed"
2728
fi
2829

qa/README.vm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,3 +585,12 @@ Recreate the mirror disk on vm03
585585
UUID=8f865731-443c-4b84-ade7-31e6ff94ee7c /silver ext2 defaults 0 0
586586
$ sudo systemctl daemon-reload
587587
$ sudo mount -a
588+
589+
Adding a new disk
590+
591+
$ disk=/dev/vdb
592+
$ sudo cfdisk $disk <- make partition 1, all of the disk
593+
$ mkfs.xfs ${disk}1
594+
$ lsblk -fs ${disk}1 -> UUID=<uuid>
595+
$ [ -d /data ] || sudo mkdir /data
596+
$ echo "UUID=<uuid> /data xfs default 0 2" | sudo tee -a /etc/fstab

qa/group

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2093,6 +2093,7 @@ pmcd.pdu
20932093
1602 pmproxy local
20942094
1603 pmproxy local
20952095
1604 pmseries pmproxy local
2096+
1605 libpcp pminfo valgrind local
20962097
1608 pmproxy local
20972098
1610 libpcp local
20982099
1611 pmlogger pmproxy pmlogpush libpcp_web local
@@ -2242,7 +2243,7 @@ pmcd.pdu
22422243
1963 pmda.linux local
22432244
1970 pmda.bpf local
22442245
1973 pcp zoneinfo python local
2245-
1976 pmdaopenmetrics python local
2246+
1976 pmda.openmetrics python local
22462247
1978 atop local pmlogrewrite
22472248
1984 pmlogconf pmda.redis local
22482249
1985 pmfind local valgrind

src/libpcp/src/e_loglabel.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
typedef struct {
3232
__uint32_t magic; /* PM_LOG_MAGIC|PM_LOG_VERS02 */
3333
__int32_t pid; /* PID of logger */
34-
__int32_t start_sec; /* start of this log (pmTimeval) */
35-
__int32_t start_usec;
34+
__int32_t start[2]; /* start time of this archive (pmTimeval) */
3635
__int32_t vol; /* current log volume no. */
3736
char hostname[PM_LOG_MAXHOSTLEN]; /* name of collection host */
3837
char timezone[PM_TZ_MAXLEN]; /* $TZ at collection host */
@@ -44,8 +43,7 @@ typedef struct {
4443
typedef struct {
4544
__uint32_t magic; /* PM_LOG_MAGIC|PM_LOG_VERS03 */
4645
__int32_t pid; /* PID of logger */
47-
__int32_t start_sec[2]; /* start of this log (__pmTimestamp) */
48-
__int32_t start_nsec;
46+
__int32_t start[3]; /* start time of this archive (__pmTimestamp) */
4947
__int32_t vol; /* current log volume no. */
5048
__uint32_t features; /* enabled archive feature bits */
5149
__uint32_t reserved; /* reserved for future use, zero padded */
@@ -115,7 +113,7 @@ __pmLogEncodeLabel(const __pmLogLabel *lp, void **buffer, size_t *length)
115113
/* swab */
116114
label.magic = htonl(lp->magic);
117115
label.pid = htonl(lp->pid);
118-
__pmPutTimestamp(&lp->start, &label.start_sec[0]);
116+
__pmPutTimestamp(&lp->start, label.start);
119117
label.vol = htonl(lp->vol);
120118
label.features = htonl(lp->features);
121119
label.reserved = 0;
@@ -139,7 +137,7 @@ __pmLogEncodeLabel(const __pmLogLabel *lp, void **buffer, size_t *length)
139137
/* swab */
140138
label.magic = htonl(lp->magic);
141139
label.pid = htonl(lp->pid);
142-
__pmPutTimeval(&lp->start, &label.start_sec);
140+
__pmPutTimeval(&lp->start, label.start);
143141
label.vol = htonl(lp->vol);
144142
memset(label.hostname, 0, sizeof(label.hostname));
145143
bytes = MINIMUM(strlen(lp->hostname), PM_LOG_MAXHOSTLEN - 1);
@@ -187,7 +185,7 @@ __pmLogDecodeLabelV3(__pmLabel_v3 *in, __pmLogLabel *lp)
187185
{
188186
__pmLogFreeLabel(lp); /* reset from earlier call */
189187
lp->pid = ntohl(in->pid);
190-
__pmLoadTimestamp(&in->start_sec[0], &lp->start);
188+
__pmLoadTimestamp(in->start, &lp->start);
191189
lp->vol = ntohl(in->vol);
192190
lp->features = ntohl(in->features);
193191
lp->hostname = strndup(in->hostname, PM_MAX_HOSTNAMELEN - 1);
@@ -200,7 +198,7 @@ __pmLogDecodeLabelV2(__pmLabel_v2 *in, __pmLogLabel *lp)
200198
{
201199
__pmLogFreeLabel(lp); /* reset from earlier call */
202200
lp->pid = ntohl(in->pid);
203-
__pmLoadTimeval(&in->start_sec, &lp->start);
201+
__pmLoadTimeval(in->start, &lp->start);
204202
lp->vol = ntohl(in->vol);
205203
lp->features = 0; /* not supported in v2 */
206204
lp->hostname = strndup(in->hostname, PM_LOG_MAXHOSTLEN - 1);

0 commit comments

Comments
 (0)