zyedidia / perforator

Record "perf" performance metrics for individual functions/regions of an ELF binary.
MIT License
69 stars 5 forks source link

Add a flag to ignore missing regions #5

Closed AlexGustafsson closed 3 years ago

AlexGustafsson commented 3 years ago

I've added a flag, --ignore-missing-regions, which will allow perforator to continue running even though it's unable to find a region.

The change is non-breaking.

The use case is times where you compare a non-optimized reference implementation with an optimized (-O3 or the like) implementation. In the latter case, GCC and friends may happily inline functions that are only used a single time. This results in the binary (symbol table) not containing the symbol at all - since it's no longer a function per say.

With this change, one may use --ignore-missing-regions to run both binaries with the same perforator command, making it more useful in scripts where it may be unknown if the target binary lacks a specific region.

zyedidia commented 3 years ago

This seems like a reasonable change. In case it's useful, if you have your compiler provide debugging information (usually -g flag) then perforator should be able to profile inlined functions.

AlexGustafsson commented 3 years ago

I added (and then removed) a log mentioning the missing function. I noticed it was already logged, so please disregard the latest changes.