Skip to content

Commit

Permalink
[profile] Update counter offset to account for binary ids
Browse files Browse the repository at this point in the history
In the raw profile, binary ids immediately follow the header so when
computing counters offset we need to account for the new section.

Differential Revision: https://reviews.llvm.org/D108608
  • Loading branch information
petrhosek committed Aug 24, 2021
1 parent d95d2a8 commit 8111f2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler-rt/lib/profile/InstrProfilingFile.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ static void initializeProfileForContinuousMode(void) {
return;
}
const uint64_t CountersOffsetInBiasMode =
sizeof(__llvm_profile_header) +
sizeof(__llvm_profile_header) + __llvm_write_binary_ids(NULL) +
(DataSize * sizeof(__llvm_profile_data));
/* Update the profile fields based on the current mapping. */
INSTR_PROF_PROFILE_COUNTER_BIAS_VAR = (intptr_t)Profile -
Expand Down
3 changes: 2 additions & 1 deletion compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ void __llvm_profile_initialize(void) {
const uint64_t *CountersEnd = __llvm_profile_end_counters();
const uint64_t DataSize = __llvm_profile_get_data_size(DataBegin, DataEnd);
const uint64_t CountersOffset =
sizeof(__llvm_profile_header) + (DataSize * sizeof(__llvm_profile_data));
sizeof(__llvm_profile_header) + __llvm_write_binary_ids(NULL) +
(DataSize * sizeof(__llvm_profile_data));
uint64_t CountersSize = CountersEnd - CountersBegin;

/* Don't publish a VMO if there are no counters. */
Expand Down

0 comments on commit 8111f2f

Please sign in to comment.