This is an archive of the discontinued LLVM Phabricator instance.

[MemProf] Defer profile file setup until dump time
AcceptedPublic

Authored by tejohnson on Nov 16 2022, 6:13 PM.

Details

Summary

With all of the writing of the memprof profile consolidated into one
place, there is no need to set up the profile file (which creates the
file and also redirects all printing from the runtime to it) until we
are ready to dump the profile.

This allows errors and other messages to be dumped to stderr instead of
the profile file, which by default is in a binary format. Additionally,
reset the output file to stderr after dumping the profile so that any
requested memprof allocator statistics are printed to stderr.

Diff Detail

Event Timeline

tejohnson created this revision.Nov 16 2022, 6:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 16 2022, 6:13 PM
Herald added a subscriber: Enna1. · View Herald Transcript
tejohnson requested review of this revision.Nov 16 2022, 6:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 16 2022, 6:13 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
This revision is now accepted and ready to land.Nov 17 2022, 10:15 AM
This revision was automatically updated to reflect the committed changes.
tejohnson reopened this revision.Nov 28 2022, 6:31 AM

This change was breaking the ability of tests to override the profile output file. Need to add a mechanism to do that before resubmitting.

This revision is now accepted and ready to land.Nov 28 2022, 6:31 AM