This is an archive of the discontinued LLVM Phabricator instance.

[memprof] Move the meminfo block struct to MemProfData.inc.
ClosedPublic

Authored by snehasish on Jan 6 2022, 5:41 PM.

Details

Summary

The definition of the MemInfoBlock is shared between the memprof
compiler-rt runtime and llvm/lib/ProfileData/. This change removes the
memprof_meminfoblock header and moves the struct to the shared include
file. To enable this sharing, the Print method is moved to the
memprof_allocator (the only place it is used) and the remaining uses are
updated to refer to the MemInfoBlock defined in the MemProfData.inc
file.

Also a couple of other minor changes which improve usability of the
types in MemProfData.inc.

  • Update the PACKED macro to handle commas.
  • Add constructors and equality operators.
  • Don't initialize the buildid field.

Diff Detail

Event Timeline

snehasish requested review of this revision.Jan 6 2022, 5:41 PM
snehasish created this revision.
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 6 2022, 5:41 PM
Herald added subscribers: llvm-commits, Restricted Project. · View Herald Transcript
davidxl added inline comments.Jan 6 2022, 9:06 PM
compiler-rt/lib/memprof/tests/rawprofile.cpp
136

More explanation on this change?

snehasish updated this revision to Diff 398232.Jan 7 2022, 1:59 PM

Address comments.

snehasish added inline comments.Jan 7 2022, 2:08 PM
compiler-rt/lib/memprof/tests/rawprofile.cpp
136

Duplicated the comment I had in the .inc file. It's useful to record the linker build id (i.e. the uuid field here: https://git.io/J9O47) however, this is not implemented in sanitizer_procmaps_linux yet. Our initial approach was to do symbolization using internal tooling and this was necessary. However, now we are going to symbolize using llvm-profdata and this is not strictly necessary anymore. It is still good to have for sanity checks as well as other visualization and analysis tools that we may build in the future.

davidxl accepted this revision.Jan 7 2022, 3:50 PM

lgtm

This revision is now accepted and ready to land.Jan 7 2022, 3:50 PM
compiler-rt/lib/memprof/memprof_allocator.cpp