[llvm-profgen] Refactor and better diagnostics
authorWenlei He <aktoon@gmail.com>
Wed, 29 Sep 2021 16:04:44 +0000 (09:04 -0700)
committerWenlei He <aktoon@gmail.com>
Thu, 30 Sep 2021 05:55:50 +0000 (22:55 -0700)
commit941191aae4abaf88b176bec8cfe1c841a5832642
tree41cf1123c4ac41c82ae803312159a824c0a079ad
parent97a0ba475d105838bd9bb7ed8506f599210995c7
[llvm-profgen] Refactor and better diagnostics

This change contains diagnostics improvments, refactoring and preparation for consuming perf data directly.

Diagnostics:
 - We now have more detailed diagnostics when no mmap is found.
 - We also print warning for abnormal transition to external code.

Refactoring:
 - Simplify input perf trace processing to only allow a single input file. This is because 1) using multiple input perf trace (perf script) is error prone because we may miss key mmap events. 2) the functionality is not really being used anyways.
 - Make more functions private for Readers, move non-trivial definitions out of header. Cleanup some inconsistency.
 - Prepare for consuming perf data as input directly.

Differential Revision: https://reviews.llvm.org/D110729
llvm/tools/llvm-profgen/PerfReader.cpp
llvm/tools/llvm-profgen/PerfReader.h
llvm/tools/llvm-profgen/llvm-profgen.cpp