Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve listing and 'probe' builtin for several probe types #2691

Merged
merged 4 commits into from
Jul 25, 2023

Conversation

viktormalik
Copy link
Contributor

@viktormalik viktormalik commented Jul 21, 2023

This allows to list hardware, software, interval, and profile probes:

# bpftrace -l 'hardware:*'
hardware:backend-stalls:
hardware:branch-instructions:
hardware:branch-misses:
hardware:bus-cycles:
hardware:cache-misses:
hardware:cache-references:
hardware:cpu-cycles:
hardware:frontend-stalls:
hardware:instructions:
hardware:ref-cycles:

# bpftrace -l 'software:*'
software:alignment-faults:
software:bpf-output:
software:context-switches:
software:cpu-clock:
software:cpu-migrations:
software:dummy:
software:emulation-faults:
software:major-faults:
software:minor-faults:
software:page-faults:
software:task-clock:

# bpftrace -l 'interval:*'
interval:hz:
interval:ms:
interval:s:
interval:us:

# bpftrace -l 'profile:*'
profile:hz:
profile:ms:
profile:s:
profile:us:

Also fixes failures when using the probe builtin from hardware and software probes.

Fixes #2690.

Checklist
  • Language changes are updated in man/adoc/bpftrace.adoc and if needed in docs/reference_guide.md
  • User-visible and non-trivial changes updated in CHANGELOG.md
  • The new behaviour is covered by tests

In probe matcher, hardware and software probes are handled with the same
code as e.g. tracepoints of kfuncs. This is not correct since hardware
and software probes never define the 'func' field, only the 'target'
field. This causes problems with probe listing:

    # bpftrace -lv 'software:*'
    software:*:

Move handling of these probes to a separate case using only 'target'.
When using the 'probe' builtin, probe is expanded even if the given
probe type doesn't support wildcards. This poses problems for hardware
and software probes as the generated probe name is not correct.

This commit fixes the problem by using the correct probe name.
It is now possible to use wildcards for profile/interval probe listing
to get the list of all available frequency units:

    # bpftrace -l 'interval:*'
    interval:hz:
    interval:ms:
    interval:s:
    interval:us:
The PR allowed listing of software, hardware, interval, and profile
probe types. Also fixed using the 'probe' builtin from hardware and
software probes.
@danobi danobi merged commit 7c2d800 into bpftrace:master Jul 25, 2023
21 checks passed
@viktormalik viktormalik deleted the probe-listing branch August 3, 2023 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wildcard listing of builtin probe types doesn't work
2 participants