void fdrLoggingHandleArg0(int32_t FuncId,
XRayEntryType Entry) XRAY_NEVER_INSTRUMENT {
auto TSC_CPU = getTimestamp();
- __xray_fdr_internal::processFunctionHook(
- FuncId, Entry, std::get<0>(TSC_CPU), std::get<1>(TSC_CPU), 0,
- clock_gettime, *BQ);
+ __xray_fdr_internal::processFunctionHook(FuncId, Entry, std::get<0>(TSC_CPU),
+ std::get<1>(TSC_CPU), 0,
+ clock_gettime, *BQ);
}
void fdrLoggingHandleArg1(int32_t FuncId, XRayEntryType Entry,
uint64_t Arg) XRAY_NEVER_INSTRUMENT {
auto TSC_CPU = getTimestamp();
- __xray_fdr_internal::processFunctionHook(
- FuncId, Entry, std::get<0>(TSC_CPU), std::get<1>(TSC_CPU), Arg,
- clock_gettime, *BQ);
+ __xray_fdr_internal::processFunctionHook(FuncId, Entry, std::get<0>(TSC_CPU),
+ std::get<1>(TSC_CPU), Arg,
+ clock_gettime, *BQ);
}
void fdrLoggingHandleCustomEvent(void *Event,
// - The metadata record we're going to write. (16 bytes)
// - The additional data we're going to write. Currently, that's the size of
// the event we're going to dump into the log as free-form bytes.
- if (!prepareBuffer(clock_gettime, MetadataRecSize + EventSize)) {
+ if (!prepareBuffer(TSC, CPU, clock_gettime, MetadataRecSize + EventSize)) {
TLD.LocalBQ = nullptr;
return;
}
return true;
}
-inline bool prepareBuffer(int (*wall_clock_reader)(clockid_t,
+inline bool prepareBuffer(uint64_t TSC, unsigned char CPU,
+ int (*wall_clock_reader)(clockid_t,
struct timespec *),
size_t MaxSize) XRAY_NEVER_INSTRUMENT {
auto &TLD = getThreadLocalData();
return false;
}
setupNewBuffer(wall_clock_reader);
+
+ // Always write the CPU metadata as the first record in the buffer.
+ writeNewCPUIdMetadata(CPU, TSC);
}
return true;
}
}
setupNewBuffer(wall_clock_reader);
+
+ // Always write the CPU metadata as the first record in the buffer.
+ writeNewCPUIdMetadata(CPU, TSC);
}
if (TLD.CurrentCPU == std::numeric_limits<uint16_t>::max()) {
// bytes in the end of the buffer, we need to write out the EOB, get a new
// Buffer, set it up properly before doing any further writing.
size_t MaxSize = FunctionRecSize + 2 * MetadataRecSize;
- if (!prepareBuffer(wall_clock_reader, MaxSize)) {
+ if (!prepareBuffer(TSC, CPU, wall_clock_reader, MaxSize)) {
TLD.LocalBQ = nullptr;
return;
}