Skip to content

Commit

Permalink
[BOLT][Instrumentation] Disallow combining append-pid with sleep-time…
Browse files Browse the repository at this point in the history
…/wait-forks

The point of instrumentation-sleep-time option is to have a watcher
process which shares memory with all other forks and dumps a common
profile each n seconds. Combining it with append-pid suggests that we
should get a private profile of each fork every n seconds, but such
behavior is not implemented currently and is not easy to implement in
general, because we somehow need to intercept each individual fork,
launch a watcher process just for that fork, and also map counters so
that they're only shared with that single fork. Since we're not doing
it, we just disallow such combination of options.

Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D153771
  • Loading branch information
treapster committed Jun 29, 2023
1 parent ad4e077 commit f6682ad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bolt/lib/RuntimeLibs/InstrumentationRuntimeLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ void InstrumentationRuntimeLibrary::adjustCommandLineOptions(
"DT_FINI to write the profile\n";
exit(1);
}

if ((opts::InstrumentationWaitForks || opts::InstrumentationSleepTime) &&
opts::InstrumentationFileAppendPID) {
errs()
<< "BOLT-ERROR: instrumentation-file-append-pid is not compatible with "
"instrumentation-sleep-time and instrumentation-wait-forks. If you "
"want a separate profile for each fork, it can only be dumped in "
"the end of process when instrumentation-file-append-pid is used.\n";
exit(1);
}
}

void InstrumentationRuntimeLibrary::emitBinary(BinaryContext &BC,
Expand Down

0 comments on commit f6682ad

Please sign in to comment.