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 25, 2024
2 parents 451e7bd + 0c3fa1c commit 5bbabb8
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
20 changes: 15 additions & 5 deletions qa/1249
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,17 @@ $5 ~ /^[0-9][0-9]*$/ { $5 = "<pid>" }

_filter_pmie()
{
sed \
if [ ! -f "$1" ]
then
echo "Arrgh! log file $1 not found ..."
ls -l `dirname "$1"`
pmiectl -V status
return
fi
echo "=== $1 ===" >>$here/$seq.full
cat "$1" \
| tee -a $here/$seq.full \
| sed \
-e '/^Log for pmie on .* started /d' \
-e 's/^[A-Za-z0-9 :]*: /DATESTAMP: /' \
-e '/^DATESTAMP: PID = /d' \
Expand Down Expand Up @@ -258,7 +268,7 @@ $sudo pmiectl -i $seq cond-create localhost 2>&1 | _filter
pmiectl -V status 2>&1 | _filter_status
grep sample.lights $PCP_LOG_DIR/pmie/$seq/$seq.config
pmsleep 0.5 # give pmie a chance to warm up
_filter_pmie <$PCP_LOG_DIR/pmie/$seq/pmie.log | sort | uniq
_filter_pmie $PCP_LOG_DIR/pmie/$seq/pmie.log | sort | uniq
echo "--- start pmie config file ---" >>$seq.full
cat $PCP_LOG_DIR/pmie/$seq/$seq.config >>$seq.full
echo "--- end pmie config file ---" >>$seq.full
Expand Down Expand Up @@ -288,7 +298,7 @@ do
grep -E "$metric( |\$)" $PCP_LOG_DIR/pmie/$seq-a/$seq-a.config
done
pmsleep 0.5 # give pmie a chance to warm up
_filter_pmie <$PCP_LOG_DIR/pmie/$seq-a/pmie.log | sort | uniq
_filter_pmie $PCP_LOG_DIR/pmie/$seq-a/pmie.log | sort | uniq
echo "--- start pmie config file ---" >>$seq.full
cat $PCP_LOG_DIR/pmie/$seq-a/$seq-a.config >>$seq.full
echo "--- end pmie config file ---" >>$seq.full
Expand All @@ -305,7 +315,7 @@ do
grep -E "$metric( |\$)" $PCP_LOG_DIR/pmie/$seq-b/$seq-b.config
done
pmsleep 0.5 # give pmie a chance to warm up
_filter_pmie <$PCP_LOG_DIR/pmie/$seq-b/pmie.log | sort | uniq
_filter_pmie $PCP_LOG_DIR/pmie/$seq-b/pmie.log | sort | uniq
echo "--- start pmie config file ---" >>$seq.full
cat $PCP_LOG_DIR/pmie/$seq-b/$seq-b.config >>$seq.full
echo "--- end pmie config file ---" >>$seq.full
Expand All @@ -322,7 +332,7 @@ do
grep -E "$metric( |\$)" $PCP_LOG_DIR/pmie/$seq-c/$seq-c.config
done
pmsleep 0.5 # give pmie a chance to warm up
_filter_pmie <$PCP_LOG_DIR/pmie/$seq-c/pmie.log | sort | uniq
_filter_pmie $PCP_LOG_DIR/pmie/$seq-c/pmie.log | sort | uniq
echo "--- start pmie config file ---" >>$seq.full
cat $PCP_LOG_DIR/pmie/$seq-c/$seq-c.config >>$seq.full
echo "--- end pmie config file ---" >>$seq.full
Expand Down
1 change: 1 addition & 0 deletions src/libpcp/src/check-statics
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ pdu.o
tracenext # guarded by pdu_lock mutex
pmns.o
pmns_lock # local mutex
pmns_fix_lock # local mutex
lineno # guarded by pmns_lock mutex
export # guarded by pmns_lock mutex
fin # guarded by pmns_lock mutex
Expand Down
1 change: 1 addition & 0 deletions src/libpcp/src/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ extern int __pmIsErrLock(void *) _PCP_HIDDEN;
extern int __pmIsLockLock(void *) _PCP_HIDDEN;
extern int __pmIsLogutilLock(void *) _PCP_HIDDEN;
extern int __pmIsPmnsLock(void *) _PCP_HIDDEN;
extern int __pmIsPmnsFixLock(void *) _PCP_HIDDEN;
extern int __pmIsAFLock(void *) _PCP_HIDDEN;
extern int __pmIsresultLock(void *) _PCP_HIDDEN;
extern int __pmIsSecureclientLock(void *) _PCP_HIDDEN;
Expand Down
2 changes: 2 additions & 0 deletions src/libpcp/src/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ static char
return "logutil";
else if (__pmIsPmnsLock(lock))
return "pmns";
else if (__pmIsPmnsFixLock(lock))
return "pmns_fix";
else if (__pmIsAFLock(lock))
return "AF";
else if (__pmIsSecureclientLock(lock))
Expand Down
15 changes: 14 additions & 1 deletion src/libpcp/src/pmns.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ static __pmnsNode *locate(const char *, __pmnsNode *);

#ifdef PM_MULTI_THREAD
static pthread_mutex_t pmns_lock;
static pthread_mutex_t pmns_fix_lock;
#else
void *pmns_lock;
#endif
Expand All @@ -126,13 +127,22 @@ __pmIsPmnsLock(void *lock)
{
return lock == (void *)&pmns_lock;
}
/*
* return true if lock == pmns_fix_lock
*/
int
__pmIsPmnsFixLock(void *lock)
{
return lock == (void *)&pmns_fix_lock;
}
#endif

void
init_pmns_lock(void)
{
#ifdef PM_MULTI_THREAD
__pmInitMutex(&pmns_lock);
__pmInitMutex(&pmns_fix_lock);
#endif
}

Expand Down Expand Up @@ -1058,14 +1068,16 @@ __pmNewPMNS(__pmnsTree **pmns)
* we are also called from __pmLogLoadMeta with the current context
* locked ... and in the later case we don't need the pmns_lock.
*
* So no lock/unlock operations here.
* But, we're also called from initarchive() and this one can
* race ... so we have a local lock _just_ for this method.
*/
int
__pmFixPMNSHashTab(__pmnsTree *tree, int numpmid, int dupok)
{
int sts;
int htabsize = numpmid/5;

PM_LOCK(pmns_fix_lock);
/*
* make the average hash list no longer than 5, and the number
* of hash table entries not a multiple of 2, 3 or 5
Expand All @@ -1090,6 +1102,7 @@ __pmFixPMNSHashTab(__pmnsTree *tree, int numpmid, int dupok)
sts = 0;

pmapi_return:
PM_UNLOCK(pmns_fix_lock);

return sts;
}
Expand Down

0 comments on commit 5bbabb8

Please sign in to comment.