[PATCH] D89707: [CSSPGO][llvm-profgen] Parse mmap events from perf script

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 10:45:59 PDT 2020


hoy added inline comments.


================
Comment at: llvm/tools/llvm-profgen/llvm-profgen.cpp:143-144
+    // Update the binary address map.
+    BinaryAddrMap.erase(Binary.getBaseAddress());
+    BinaryAddrMap[Event.BaseAddress] = &Binary;
+
----------------
mtrofin wrote:
> wlei wrote:
> > wlei wrote:
> > > mtrofin wrote:
> > > > wmi wrote:
> > > > > Here BinaryAddrMap needs to erase an entry before inserting a new one. I guess it is to support the case that a load image is unloaded and then reloaded at a different place. If that is correct, please add some comment to make it clear. 
> > > > Naive question: that assumes no interesting events were collected when the image was loaded at the old address?
> > > yes , comments added
> > Not sure whether it will remain the same address, but here I think it will cover this case. or maybe you want me to check if the base address doesn't change then we can just drop this event?
> Sorry, what I meant was: as the events list gets traversed, say that for a while events corresponding to the current base address are captured; then the base address changes. What happens to the captured events?
The events come in order of time. The mmap events serve as a time stamp for all LBR and call stack events. Once a mmap event is processed, the binary load loaded address recorded will be updated and all subsequent LBR events will be processed against the updated base address.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89707/new/

https://reviews.llvm.org/D89707



More information about the llvm-commits mailing list