This is an archive of the discontinued LLVM Phabricator instance.

[BOLT][Instrumentation] Keep profile open in WatchProcess
ClosedPublic

Authored by treapster on Jul 4 2023, 4:47 AM.

Details

Summary

When a binary is instrumented with --instrumentation-sleep-time and instrumentation-wait-forks options and lauched, the profile is periodically written until all the forks die. The problem is that we cannot wait for the whole process tree, and we have no way to tell when it's safe to read the profile. Hovewer, if we keep profile open throughout the life of the process tree, we can use fuser to determine when writing is finished. It will help us to write robust tests for instrumentation, as mentioned in https://reviews.llvm.org/D153771.

Diff Detail

Event Timeline

treapster created this revision.Jul 4 2023, 4:47 AM
Herald added a reviewer: Amir. · View Herald Transcript
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: ayermolo. · View Herald Transcript
treapster requested review of this revision.Jul 4 2023, 4:47 AM
treapster updated this revision to Diff 537258.Jul 5 2023, 1:45 AM

SEEK_END -> SEEK_SET

treapster updated this revision to Diff 537261.Jul 5 2023, 1:57 AM

Add diff context

Thanks for working on this @treapster . Can you add to your diff stack a diff that adds a test that uses this improved mechanism?

Thanks for working on this @treapster . Can you add to your diff stack a diff that adds a test that uses this improved mechanism?

I added a test in D154121, but it looks like it won't work until D153771 is fully relanded, and adding it as parent is not working because it's closed. If you or Amir approve D153771, i'll reland and things will get easier.

treapster updated this revision to Diff 544668.Jul 27 2023, 2:45 AM

Add return value checks

rafauler accepted this revision.Aug 23 2023, 12:16 PM

Thanks! LGTM

This revision is now accepted and ready to land.Aug 23 2023, 12:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2023, 1:51 PM