This is an archive of the discontinued LLVM Phabricator instance.

Speed up NativeProcessLinux::GetLoadedModuleFileSpec
ClosedPublic

Authored by labath on Jul 23 2015, 7:26 AM.

Details

Summary

GetLoadedModuleFileSpec was reading /proc/pid/maps character by character, which was very slow,
since we do that for every shared library, which android tends to have a lot. Switching to
ProcFileReader saves us about 0.4 seconds in attach time.

Diff Detail

Event Timeline

labath updated this revision to Diff 30481.Jul 23 2015, 7:26 AM
labath retitled this revision from to Speed up NativeProcessLinux::GetLoadedModuleFileSpec.
labath updated this object.
labath added a reviewer: tberghammer.
labath added a subscriber: lldb-commits.
tberghammer accepted this revision.Jul 23 2015, 7:41 AM
tberghammer edited edge metadata.

LGTM

Thanks for doing it. I planed to do it for a long time as a cleanup, but haven't expected it to have any effect on attach speed. If you still aren't happy with the parsing speed you can possibly cache the the content of /proc/<pid>/maps in memory for the time the process is stopped.

This revision is now accepted and ready to land.Jul 23 2015, 7:41 AM
This revision was automatically updated to reflect the committed changes.

Sounds like a good idea. That would help us a lot with qMemoryRegionInfo packets as well. I'll look into that.