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

ProcSyms: fix off-by-ones, use binary search to resolve addresses #594

Merged
merged 2 commits into from
Jul 1, 2016
Merged

ProcSyms: fix off-by-ones, use binary search to resolve addresses #594

merged 2 commits into from
Jul 1, 2016

Conversation

markdrayton
Copy link
Contributor

This PR:

a) fixes a couple of off-by-one bugs in matching modules and symbols. Specifically, when given two adjacent symbols resolving the start address of the second symbol would incorrectly return the first symbol. This diff fixes the ProcSyms::Module code, removes the workaround in bcc_perf_map_foreach_sym(), and adds a test.

b) switches to a binary search in ProcSyms::Module::find_addr(). The current linear search isn't very good on large mappings (some of our JIT maps are hundreds of thousands of entries).

@vmg
Copy link
Contributor

vmg commented Jul 1, 2016

Ah yes, std::upper_bound seems like a good fit here. The original Python version used the naive loop, but this is most definitely a worthy optimization. 👌

@4ast 4ast merged commit ab78817 into iovisor:master Jul 1, 2016
@markdrayton markdrayton deleted the faster-procsyms branch July 11, 2016 09:13
abirchall pushed a commit to abirchall/bcc that referenced this pull request Jul 11, 2016
…visor#594)

* libbcc: fix off-by-one errors in resolving adjacent modules/symbols, add test

* libbcc: use binary search in ProcSyms::Module::find_addr()
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.

3 participants