This is an archive of the discontinued LLVM Phabricator instance.

[XRay] cache symbolized function names for a repeatedly queried function ID
ClosedPublic

Authored by pelikan on Feb 28 2018, 12:59 PM.

Details

Summary

Processing 2 GB XRay traces with "llvm-xray convert -symbolize" needs to
go over each trace record and symbolize the function name refered to by
its ID. Currently this happens by asking the LLVM symbolizer code every
single time. A simple cache can save around 30 minutes of processing of
my testing trace which took ~100 minutes at HEAD and ~40 minutes with
D43892 also in, making the combined speedup around 10×.

llvm-xray's resident memory usage increased negligibly with this cache.

Diff Detail

Event Timeline

pelikan created this revision.Feb 28 2018, 12:59 PM
pelikan edited the summary of this revision. (Show Details)Feb 28 2018, 1:02 PM
pelikan edited the summary of this revision. (Show Details)
dberris accepted this revision.Feb 28 2018, 5:47 PM

Just one suggested change, but should be good to land after.

Thanks, @pelikan!

tools/llvm-xray/func-id-helper.h
32

Can you use an llvm::DenseMap instead of the standard (poorly performing) one instead?

This revision is now accepted and ready to land.Feb 28 2018, 5:47 PM
pelikan updated this revision to Diff 136451.Feb 28 2018, 5:59 PM

std::unordered_map -> llvm::DenseMap (as requested)

pelikan marked an inline comment as done.Feb 28 2018, 6:00 PM
pelikan added inline comments.
tools/llvm-xray/func-id-helper.h
32

I actually tested the speed difference with std::map only, and used unordered_map just like FunctionAddressMap does above. I'm happy to change it though.

This revision was automatically updated to reflect the committed changes.
pelikan marked an inline comment as done.