Skip to content

usdt: avoid quadratic probe lookup - #5579

Open
sairex53 wants to merge 1 commit into
iovisor:masterfrom
sairex53:fix-5161-usdt-index
Open

sairex53 wants to merge 1 commit into
iovisor:masterfrom
sairex53:fix-5161-usdt-index

Conversation

@sairex53

Copy link
Copy Markdown

Context::add_probe() currently scans every previously collected probe to merge locations with the same provider and name. On binaries with many USDT entries, this makes context creation quadratic.

Keep the ordered probe vector for iteration and add a provider/name index for average constant-time lookup. Repeated entries reuse the indexed probe and append their location. The regression test verifies that duplicate entries are merged into one probe with two locations.

Fixes #5161.

Testing:

  • cmake --build /tmp/bcc-5161-build --target test_libbcc -j1 — passed.
  • ./test_libbcc "test finding a probe in our own process" — all 10 assertions passed; the process then aborts during LLVM TensorSpec static teardown. This also occurs with --list-tests, before any test runs.
  • git show --check HEAD — passed.

This branch has not been deployed

No deployments
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.

Reading USDT Probes is a O(n^2) operation

1 participant