Commit 71600e70 authored by Brenden Blanco's avatar Brenden Blanco Committed by GitHub

Merge pull request #1020 from goldshtn/duplicate_modules

cc: Don't parse the same module multiple times for USDT probes
parents 601a13fd 69948a69
......@@ -200,7 +200,13 @@ void Context::_each_probe(const char *binpath, const struct bcc_elf_usdt *probe,
}
int Context::_each_module(const char *modpath, uint64_t, uint64_t, void *p) {
bcc_elf_foreach_usdt(modpath, _each_probe, p);
Context *ctx = static_cast<Context *>(p);
// Modules may be reported multiple times if they contain more than one
// executable region. We are going to parse the ELF on disk anyway, so we
// don't need these duplicates.
if (ctx->modules_.insert(modpath).second /*inserted new?*/) {
bcc_elf_foreach_usdt(modpath, _each_probe, p);
}
return 0;
}
......
......@@ -191,6 +191,7 @@ public:
class Context {
std::vector<std::unique_ptr<Probe>> probes_;
std::unordered_set<std::string> modules_;
optional<int> pid_;
optional<ProcStat> pid_stat_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment