Sign in to follow this  
momotte

profiling binaries for space, not speed

Recommended Posts

Hi all.

I'm looking for a tool that can analyze a binary file (.exe or .dll), and tell which functions take the most space in the .text section.
even perhaps be able to list the original object files and sort them by size used in the final binary? (just sorting the various .obj files by size doesn't do the trick).
I'm on windows, and using visual studio 2008 and 2010, if that has any relevance to the matter. I didn't see any linker switches that would help with this problem btw.

would you happen to know such a tool ?
it shouldn't be too difficult to code provided debug information is embedded within the binary file, as it would just be a matter of listing symbols and finding their sizes through the debug API, but it would be better if something like that already existed :)

Share this post


Link to post
Share on other sites
Well, this isn't quite the answer you are looking for, but:
You can set the "Generate Map File" option in the linker settings. That should give you an output file with all the symbols, their sizes, and their locations.

Share this post


Link to post
Share on other sites
ah, great! at least now I've got some info in human-readable form...
thanks!

the original question still stands though, manually looking through the unsorted 8Mb .map file is a bit hardcore... :)

Share this post


Link to post
Share on other sites
Quote:
Original post by momotte
ah, great! at least now I've got some info in human-readable form...
thanks!

the original question still stands though, manually looking through the unsorted 8Mb .map file is a bit hardcore... :)

Open it in Excel. You'll need to manually tell it where column breaks go. Then hit sort.

You can also use some quick processing to extract out libraries or other information from the map file. For fancy stuff you can create pivot tables to see how much space everything in each library and subsystem and each class requires. This works on any system, not just the specific formats of a specific compiler.

Another option if you need to filter is to use grep or awk or a similar tool to extract just the lines you want, then sort the output.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this