Skip to content

Commit

Permalink
pmdabpftrace: deduplicate tracepoint names
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgerstmayr committed Dec 17, 2020
1 parent f5fe105 commit 9448695
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
38 changes: 38 additions & 0 deletions qa/1725
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
# PCP QA Test No. 1725
# Exercise the bpftrace PMDA - list tracepoints
#

seq=`basename $0`
echo "QA output created by $seq"

. ./common.bpftrace

_pmdabpftrace_check

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

_prepare_pmda bpftrace
trap "_pmdabpftrace_cleanup; exit \$status" 0 1 2 3 15
_stop_auto_restart pmcd


# real QA test starts here
_pmdabpftrace_clean_autostart_scripts
cat <<EOF | _pmdabpftrace_install
# Installed by PCP QA test $seq on `date`
EOF

echo "=== check tracepoint metric ==="
pminfo -dmtT bpftrace.info.tracepoints

echo
echo "=== check example tracepoint metric value ==="
pminfo -f bpftrace.info.tracepoints | tr ',' '\n' \
| grep kprobe:version_show


_pmdabpftrace_remove
status=0
exit
26 changes: 26 additions & 0 deletions qa/1725.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
QA output created by 1725

=== bpftrace agent installation ===
Updating the Performance Metrics Name Space (PMNS) ...
Terminate PMDA if already installed ...
[...install files, make output...]
Updating the PMCD control file, and notifying PMCD ...
Check bpftrace metrics have appeared ... 7 metrics and X values

=== check tracepoint metric ===

bpftrace.info.tracepoints PMID: 151.1.2 [list all available tracepoints]
Data Type: string InDom: PM_INDOM_NULL 0xffffffff
Semantics: instant Units: none
Help:
list all available tracepoints

=== check example tracepoint metric value ===
kprobe:version_show

=== remove bpftrace agent ===
Culling the Performance Metrics Name Space ...
bpftrace ... done
Updating the PMCD control file, and notifying PMCD ...
[...removing files...]
Check bpftrace metrics have gone away ... OK
1 change: 1 addition & 0 deletions qa/group
Original file line number Diff line number Diff line change
Expand Up @@ -1849,6 +1849,7 @@ x11
1722 pmda.bpftrace local python
1723 pmda.bpftrace local python
1724 pmda.bpftrace local python
1725 pmda.bpftrace local python
1740 pmda.proc local
1745 pmlogger libpcp pmval local
1763 pmlogctl local
Expand Down
5 changes: 4 additions & 1 deletion src/pmdas/bpftrace/bpftrace/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ def get_bpftrace_version(bpftrace_path: str) -> Optional[Tuple]:


def get_tracepoints_csv(bpftrace_path: str) -> str:
return subprocess.check_output([bpftrace_path, '-l'], encoding='utf8').strip().replace('\n', ',')
# use a set to prevent duplicate probes
# see https://github.com/iovisor/bpftrace/issues/1581
tracepoints = frozenset(subprocess.check_output([bpftrace_path, '-l'], encoding='utf8').split())
return ','.join(tracepoints)


def asyncio_get_all_tasks(loop):
Expand Down

0 comments on commit 9448695

Please sign in to comment.