This is an archive of the discontinued LLVM Phabricator instance.

Improve the performance of jModulesInfo in lldb-server
ClosedPublic

Authored by tberghammer on Jan 3 2017, 7:21 AM.

Details

Summary

Improve the performance of jModulesInfo in lldb-server

Previously it parsed /proc/<pid>/maps for every module separately
resulting in a very slow response time. This CL add some caching and
optimizes the implementation to improve the code from O(n*m) to O(n+m)
where n is the number of modules requested and m is the number of
files mapped into memory.

Diff Detail

Repository
rL LLVM

Event Timeline

tberghammer updated this revision to Diff 82884.Jan 3 2017, 7:21 AM
tberghammer retitled this revision from to Improve the performance of jModulesInfo in lldb-server.
tberghammer updated this object.
tberghammer added a reviewer: labath.
tberghammer added a subscriber: lldb-commits.
labath accepted this revision.Jan 3 2017, 7:43 AM
labath edited edge metadata.

Looks great, thanks.

Do you have any measurements on the real impact this makes on jModulesInfo packet?

source/Plugins/Process/Linux/NativeProcessLinux.cpp
1757 ↗(On Diff #82884)

Please put an early return here:
if (!cache.empty() { log_if_you_want_to(); return Error(); }

This revision is now accepted and ready to land.Jan 3 2017, 7:43 AM
tberghammer marked an inline comment as done.Jan 3 2017, 8:37 AM

On some extremely large cases I seen the response time to fell from ~120s to ~8s (default packet timeout is 2s).

This revision was automatically updated to reflect the committed changes.