[llvm-dev] XRay feature – pid reporting
Dean Michael Berris via llvm-dev
llvm-dev at lists.llvm.org
Tue Jun 26 16:31:22 PDT 2018
> On 27 Jun 2018, at 01:46, Henry Zhu <henryzhu at seas.upenn.edu> wrote:
> I'm not too clear on what you mean by changing the version number. Does that mean that I should change the Header.Version = 3? Therefore, I should add XRayPidPayload to xray_records.h and install a handler for fetching the pid like what was done in those commits?
This is the preferred way of doing it (updating the log version number). We have a set of metadata records in FDR mode to support writing down the thread ID at the start of the FDR mode block as a trade-off to reduce the log size. We’ll need a similar change in FDR mode to support writing the process ID at the start of the block as well.
Basic mode doesn’t make this trade-off which means you need to update the basic mode file header and function records to always include the process ID.
> Originally, I thought of modifying XRayRecord to contain pid field since there is an unused buffer at the end that could hold the pid value.
The XRayRecord type in LLVM is only used by the tooling, so this definitely could work. In compiler-rt though we need to be able to write them down in all modes that we support — this means writing it down in FDR, Basic, and Profiling mode.
For Basic mode, adding the PID in every record should be OK but we still need to update the version number and add the PID in the file header as well.
More information about the llvm-dev