This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Implement --stats
ClosedPublic

Authored by davide on Feb 15 2015, 4:46 PM.

Details

Summary

I used this quite a bit for some internal benchmarking, and seems to be working (at least for the time side). GetMallocUsage() appears to be broken on FreeBSD-11 + tcmalloc(), and I'll investigate on the reason, but I would like to get another pair of eye on this patch in the meanwhile.
I can write an unit test, if needed.

Diff Detail

Event Timeline

davide updated this revision to Diff 19993.Feb 15 2015, 4:46 PM
davide retitled this revision from to [ELF] Implement --stats.
davide updated this object.
davide edited the test plan for this revision. (Show Details)
davide set the repository for this revision to rL LLVM.
davide added a project: lld.
davide added subscribers: Unknown Object (MLST), emaste.

D7663 takes care of GetMallocUsage() bits. My previous comment should be read as GetMallocUsage() appears to be broken on FreeBSD-11 + jemalloc" and not as "GetMallocUsage() appears to be broken on FreeBSD-11 + tcmalloc".

r229824 is in llvm, so this can be reviewed now.

ruiu accepted this revision.Feb 19 2015, 11:55 AM
ruiu edited edge metadata.

LGTM

lib/Driver/GnuLdDriver.cpp
181

total -> Total

"data size" may be confusing -- this can be read as the total number of bytes read from disk, for example. Needs a bit of wordsmithing.

This revision is now accepted and ready to land.Feb 19 2015, 11:55 AM

should this be a general option in LinkingContext ? Why is this specific to the GnuFlavor ? Are you planning to add the stats collection for individual passes that run during Linkstep ?

davide added inline comments.Feb 19 2015, 3:56 PM
lib/Driver/GnuLdDriver.cpp
181

This is what GNU ld uses. I agree with you it's a poorly chosen sequence of words, so we need to decide if we want to stick with what they currently output or introduce our own notion of statistics. At this point I can also say that we can output something more meaningful/fine-grained.
Considering this isn't a very common option for ld(1) we can probably go for the path of breaking compatibility but I would like to have a more detailed discussion about it before taking any actions.

ruiu added a comment.Feb 19 2015, 5:56 PM

LGTM

lib/Driver/GnuLdDriver.cpp
181

Ah, it's okay then. It's better to keep the same wording as the GNU linker if there's no reason to change them. I'm also okay to keep it for the GNU driver only for now as we don't know what command line option should be used to enable this feature for other drivers. (For PE/COFF, it should be enabled when /verbose is given? Perhaps. But I don't know.) It's pretty easy to move this to Driver in future.

davide closed this revision.Feb 22 2015, 4:09 PM