llvm-project/llvm/lib/MC
wlei 47b0758049 [SampleFDO] Persist profile staleness metrics into binary
With https://reviews.llvm.org/D136627, now we have the metrics for profile staleness based on profile statistics, monitoring the profile staleness in real-time can help user quickly identify performance issues. For a production scenario, the build is usually incremental and if we want the real-time metrics, we should store/cache all the old object's metrics somewhere and pull them in a post-build time. To make it more convenient, this patch add an option to persist them into the object binary, the metrics can be reported right away by decoding the binary rather than polling the previous stdout/stderrs from a cache system.

For implementation, it writes the statistics first into a new metadata section(llvm.stats) then encode into a special ELF `.llvm_stats` section. The section data is formatted as a list of key/value pair so that future statistics can be easily extended. This is also under a new switch(`-persist-profile-staleness`)

In terms of size overhead, the metrics are computed at module level, so the size overhead should be small, measured on one of our internal service, it costs less than < 1MB for a 10GB+ binary.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D136698
2022-11-09 22:34:33 -08:00
..
MCDisassembler [MC,llvm-objdump,ARM] Target-dependent disassembly resync policy. 2022-07-26 09:35:30 +01:00
MCParser Move getenv for AS_SECURE_LOG_FILE to clang 2022-10-28 16:08:04 -07:00
CMakeLists.txt [DirectX][MC] Add MC support for DXContainer 2022-06-17 21:19:32 -05:00
ConstantPools.cpp [MC] De-capitalize SwitchSection. NFC 2022-06-10 22:50:55 -07:00
ELFObjectWriter.cpp [MC] .addrsig_sym: ignore unregistered symbols 2022-10-11 15:07:14 -07:00
MCAsmBackend.cpp [llvm] Remove includes of `llvm/Support/STLArrayExtras.h` 2022-09-09 17:44:00 -06:00
MCAsmInfo.cpp [MC] Make MCAsmInfo::isAcceptableChar reflect MCAsmInfo::doesAllowAtInName 2022-03-29 14:01:32 -07:00
MCAsmInfoCOFF.cpp
MCAsmInfoDarwin.cpp
MCAsmInfoELF.cpp
MCAsmInfoGOFF.cpp
MCAsmInfoWasm.cpp
MCAsmInfoXCOFF.cpp
MCAsmMacro.cpp
MCAsmStreamer.cpp [PseudoProbe] Replace relocation with offset for entry probe. 2022-10-27 13:28:22 -07:00
MCAssembler.cpp Revert "Rebase: [Facebook] [MC] Introduce NeverAlign fragment type" 2022-07-11 09:50:47 -07:00
MCCodeEmitter.cpp
MCCodeView.cpp [MC] Lower case the first letter of EmitCOFF* EmitWin* EmitCV*. NFC 2022-05-26 00:14:08 -07:00
MCContext.cpp Move getenv for AS_SECURE_LOG_FILE to clang 2022-10-28 16:08:04 -07:00
MCDXContainerStreamer.cpp [DirectX][MC] Add MC support for DXContainer 2022-06-17 21:19:32 -05:00
MCDXContainerWriter.cpp [DX] Create globals for DXContainer parts 2022-10-18 11:48:08 -05:00
MCDwarf.cpp [MC] Consider IsMTETaggedFrame in CIEKey 2022-10-12 14:51:24 -07:00
MCELFObjectTargetWriter.cpp
MCELFStreamer.cpp [MC][ELF] Mark GNU ABI if ifunc are used 2022-08-25 18:19:10 -03:00
MCExpr.cpp [NVPTX] Disable parens for identifiers starting with '$' 2022-04-17 18:02:33 +03:00
MCFragment.cpp Revert "Rebase: [Facebook] [MC] Introduce NeverAlign fragment type" 2022-07-11 09:50:47 -07:00
MCInst.cpp
MCInstPrinter.cpp
MCInstrAnalysis.cpp
MCInstrDesc.cpp
MCInstrInfo.cpp
MCLabel.cpp
MCLinkerOptimizationHint.cpp
MCMachOStreamer.cpp [MC] Emit Stackmaps before debug info 2022-09-06 20:20:56 +02:00
MCMachObjectTargetWriter.cpp
MCNullStreamer.cpp [MC] De-capitalize MCStreamer functions 2022-06-07 00:31:02 -07:00
MCObjectFileInfo.cpp [SampleFDO] Persist profile staleness metrics into binary 2022-11-09 22:34:33 -08:00
MCObjectStreamer.cpp [MC] .addrsig_sym: ignore unregistered symbols 2022-10-11 15:07:14 -07:00
MCObjectWriter.cpp
MCPseudoProbe.cpp [PseudoProbe] Replace relocation with offset for entry probe. 2022-10-27 13:28:22 -07:00
MCRegisterInfo.cpp
MCSPIRVStreamer.cpp [SPIR-V](3/6) Add MC layer, object file support, and InstPrinter 2022-04-20 01:10:25 +02:00
MCSchedule.cpp [llvm] Use value instead of getValue (NFC) 2022-07-13 23:11:56 -07:00
MCSection.cpp
MCSectionCOFF.cpp [MC][COFF] Add COFF section flag "Info" 2022-10-19 10:32:58 +08:00
MCSectionDXContainer.cpp [DirectX][MC] Add MC support for DXContainer 2022-06-17 21:19:32 -05:00
MCSectionELF.cpp [Object] Add ELF section type for offloading objects 2022-07-07 12:20:30 -04:00
MCSectionMachO.cpp [lld-macho] Support synthesizing __TEXT,__init_offsets 2022-08-31 10:13:45 +02:00
MCSectionWasm.cpp [MC] Fix letter case of some MCSection member functions 2022-03-11 20:07:00 -08:00
MCSectionXCOFF.cpp [llvm] Use value instead of getValue (NFC) 2022-07-13 23:11:56 -07:00
MCStreamer.cpp [PseudoProbe] Replace relocation with offset for entry probe. 2022-10-27 13:28:22 -07:00
MCSubtargetInfo.cpp Allow data prefetch into non-default address space 2022-07-27 10:01:26 -07:00
MCSymbol.cpp
MCSymbolELF.cpp
MCSymbolXCOFF.cpp
MCTargetOptions.cpp [MC][re-land] Omit DWARF unwind info if compact unwind is present where eligible 2022-06-12 17:24:19 -04:00
MCTargetOptionsCommandFlags.cpp Move getenv for AS_SECURE_LOG_FILE to clang 2022-10-28 16:08:04 -07:00
MCValue.cpp
MCWasmObjectTargetWriter.cpp
MCWasmStreamer.cpp [LLVM] Add exported visibility style for XCOFF 2022-04-28 14:56:00 -04:00
MCWin64EH.cpp [AArch64][Windows] Add MC support for save_any_reg. 2022-10-18 11:45:27 -07:00
MCWinCOFFStreamer.cpp [MC] De-capitalize SwitchSection. NFC 2022-06-10 22:50:55 -07:00
MCWinEH.cpp
MCXCOFFObjectTargetWriter.cpp
MCXCOFFStreamer.cpp [PowerPC] XCOFF exception section support on the direct assembler path 2022-09-26 22:24:20 -04:00
MachObjectWriter.cpp [MC] .addrsig_sym: ignore unregistered symbols 2022-10-11 15:07:14 -07:00
SPIRVObjectWriter.cpp [SPIR-V](3/6) Add MC layer, object file support, and InstPrinter 2022-04-20 01:10:25 +02:00
StringTableBuilder.cpp
SubtargetFeature.cpp [llvm] Qualify auto (NFC) 2022-08-07 23:55:27 -07:00
TargetRegistry.cpp TargetRegistry: Don't add "error" to error messages 2022-04-19 22:29:16 -04:00
WasmObjectWriter.cpp [WebAssembly][MC] Avoid the need for .size directives for functions 2022-08-31 14:28:56 -07:00
WinCOFFObjectWriter.cpp [MC] .addrsig_sym: ignore unregistered symbols 2022-10-11 15:07:14 -07:00
XCOFFObjectWriter.cpp [llvm] Remove redundaunt virtual specifiers (NFC) 2022-07-24 21:50:35 -07:00