Hello,
I am initializing FDR mode and finalizing/flushing the buffers manually. XRay does not log calls from the main thread unless there is a function call after __xray_log_finalize(). This behavior is abnormal since one would expect the trace file to contain all function calls made up to the point when __xray_log_finalize() is called. To demonstrate this behavior, I have taken the test case from TestCases/Posix and modified it.
I am running Ubuntu 16.04.1 on a x86_64 machine and am using clang 7.0.
henry@OptiPlex-9010:~$ uname -a
Linux OptiPlex-9010 4.13.0-43-generic #48~16.04.1-Ubuntu SMP Thu May 17 12:56:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
I will demonstrate the behavior mentioned above by displaying the result from the test file and then the result from modifying the fdr-mode.cc test provided in the TestCases/Posix directory.
====UNMODIFIED fdr-mode.cc====
./clang++ -fxray-instrument fdr-mode.cc -o fdr-mode
XRAY_OPTIONS=“patch_premain=false xray_mode=xray-fdr verbosity=1” XRAY_FDR_OPTIONS=“func_duration_thr eshold_us=0” ./fdr-mode
Logging before init.
==31756==Initializing FDR mode with options: buffer_size=16384:buffer_max=10
==31756==XRay FDR init successful.
Init status 2
Patching…
Joined
Finalize status 4
Main execution var = 6
==31756==XRay: Log file in ‘xray-log.fdr-mode.Xubrrm’
Flush status 2
henry@OptiPlex-9010:~/build_xray/llvm-instrumented-build/bin$ ./llvm-xray convert -f yaml -symbolize -instr_map=./fdr-mode xray-log.fdr-mode.Xubrrm
fdr-mode.cc (5.66 KB)