<div dir="ltr">


















<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">Hello,</span><br></p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">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.<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">I am running Ubuntu 16.04.1 on a x86_64 machine and am using
clang 7.0.<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">henry@OptiPlex-9010:~$ uname -a<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">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<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">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. <span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">====UNMODIFIED fdr-mode.cc====<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">./clang++ -fxray-instrument fdr-mode.cc -o fdr-mode<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">XRAY_OPTIONS="patch_premain=false xray_mode=xray-fdr
verbosity=1" XRAY_FDR_OPTIONS="func_duration_thr eshold_us=0"
./fdr-mode<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Logging before init.<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">==31756==Initializing FDR mode with options:
buffer_size=16384:buffer_max=10<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">==31756==XRay FDR init successful.<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Init status 2<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Patching...<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Joined<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Finalize status 4<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Main execution var = 6<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">==31756==XRay: Log file in 'xray-log.fdr-mode.Xubrrm'<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Flush status 2<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">henry@OptiPlex-9010:~/build_xray/llvm-instrumented-build/bin$
./llvm-xray convert<span>  </span>-f yaml -symbolize
-instr_map=./fdr-mode xray-log.fdr-mode.Xubrrm<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">---<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">header:<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>version:<span>         </span>2<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>type:<span>            </span>1<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>constant-tsc:<span>    </span>true<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>nonstop-tsc:<span>     </span>true<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>cycle-frequency:
3400000000<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">records:<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 3, function: 'fA()', cpu: 2, thread: 31756, kind: function-enter, tsc:
4955892956329578 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 2, thread: 31756, kind: function-enter, tsc:
4955892956357542 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 2, thread: 31756, kind: function-enter, tsc:
4955892956358238 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 2, thread: 31756, kind: function-exit, tsc:
4955892956358730 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 2, thread: 31756, kind: function-exit, tsc:
4955892956412062 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 3, function: 'fA()', cpu: 2, thread: 31756, kind: function-exit, tsc:
4955892956412434 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 2, thread: 31756, kind: function-enter, tsc:
4955892956412734 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 2, thread: 31756, kind: function-exit, tsc:
4955892956413034 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 2, thread: 31756, kind: function-enter, tsc:
4955892956413422 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 2, thread: 31756, kind: function-enter, tsc:
4955892956413686 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 2, thread: 31756, kind: function-exit, tsc:
4955892956413906 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 2, thread: 31756, kind: function-exit, tsc:
4955892956414154 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 3, function: 'fA()', cpu: 2, thread: 31756, kind: function-enter, tsc:
4955892956414378 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 2, thread: 31756, kind: function-enter, tsc:
4955892956414638 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 2, thread: 31756, kind: function-enter, tsc:
4955892956414878 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 2, thread: 31756, kind: function-exit, tsc:
4955892956415094 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 2, thread: 31756, kind: function-exit, tsc:
4955892956415338 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 3, function: 'fA()', cpu: 2, thread: 31756, kind: function-exit, tsc:
4955892956415550 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 2, thread: 31756, kind: function-enter, tsc:
4955892956415774 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 2, thread: 31756, kind: function-exit, tsc:
4955892956416022 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 0, thread: 31757, kind: function-enter, tsc:
4955892956513912 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 0, thread: 31757, kind: function-exit, tsc:
4955892956521160 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 0, thread: 31757, kind: function-enter, tsc:
4955892956521896 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 0, thread: 31757, kind: function-enter, tsc:
4955892956522296 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 0, thread: 31757, kind: function-exit, tsc:
4955892956522520 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 0, thread: 31757, kind: function-exit, tsc:
4955892956522804 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 3, function: 'fA()', cpu: 0, thread: 31757, kind: function-enter, tsc:
4955892956523144 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 0, thread: 31757, kind: function-enter, tsc:
4955892956523424 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 0, thread: 31757, kind: function-enter, tsc:
4955892956523672 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 0, thread: 31757, kind: function-exit, tsc:
4955892956523896 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 0, thread: 31757, kind: function-exit, tsc:
4955892956524172 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 3, function: 'fA()', cpu: 0, thread: 31757, kind: function-exit, tsc:
4955892956524424 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 4, function: 'fArg(int)', args: [ 1 ], cpu: 0, thread: 31757, kind:
function-enter-arg, tsc: 4955892956525092 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 4, function: 'fArg(int)', cpu: 0, thread: 31757, kind: function-exit,
tsc: 4955892956527200 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">...<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">The logger prints out “==31756==XRay: Log file in 'xray-log.fdr-mode.Xubrrm'”
and there is a TID associated with the main thread in the trace file. However,
in the modified fdr-mode.cc shown below, the trace does not report the main
thread’s id.<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">=====MODIFIED fdr-mode.cc======<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">The only change I made was commenting out the call to fC()
on line 74 before the call to<span>  </span>std::cout
<< "Main execution var = " << var << std::endl;<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN: %clangxx_xray -g -std=c++11 %s -o %t<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN: rm fdr-logging-test-* || true<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN: rm fdr-unwrite-test-* || true<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN: XRAY_OPTIONS="patch_premain=false
xray_logfile_base=fdr-logging-test- \<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN:<span>    
</span>xray_mode=xray-fdr verbosity=1" \<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN:
XRAY_FDR_OPTIONS="func_duration_threshold_us=0" \<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN:<span>     </span>%run %t
2>&1 | FileCheck %s<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN: XRAY_OPTIONS="patch_premain=false \<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN:<span>    
</span>xray_logfile_base=fdr-unwrite-test- xray_mode=xray-fdr \<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN:<span>    
</span>verbosity=1" \<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN:
XRAY_FDR_OPTIONS="func_duration_threshold_us=5000" \<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN:<span>     </span>%run %t
2>&1 | FileCheck %s<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN: %llvm_xray convert --symbolize --output-format=yaml
-instr_map=%t \<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN:<span>     </span>"`ls
fdr-logging-test-* | head -1`" \<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN:<span>     </span>|
FileCheck %s --check-prefix=TRACE<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN: %llvm_xray convert --symbolize --output-format=yaml
-instr_map=%t \<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN:<span>     </span>"`ls
fdr-unwrite-test-* | head -1`" \<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN:<span>     </span>| FileCheck
%s --check-prefix=UNWRITE<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN: rm fdr-logging-test-*<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// RUN: rm fdr-unwrite-test-*<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// FIXME: Make llvm-xray work on non-x86_64 as well.<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// REQUIRES: x86_64-target-arch<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// REQUIRES: built-in-llvm-tree<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">#include "xray/xray_log_interface.h"<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">#include <cassert><span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">#include <chrono><span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">#include <cstdio><span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">#include <iostream><span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">#include <stdlib.h><span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">#include <thread><span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">#include <time.h><span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">thread_local uint64_t var = 0;<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">[[clang::xray_always_instrument]] void
__attribute__((noinline)) fC() { ++var; }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">[[clang::xray_always_instrument]] void
__attribute__((noinline)) fB() { fC(); }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">[[clang::xray_always_instrument]] void
__attribute__((noinline)) fA() { fB(); }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">[[clang::xray_always_instrument, clang::xray_log_args(1)]]<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">void __attribute__((noinline)) fArg(int) { }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">int main(int argc, char *argv[]) {<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>using namespace
__xray;<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>std::cout <<
"Logging before init." << std::endl;<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>// CHECK: Logging
before init.<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> 
</span>assert(__xray_log_select_mode("xray-fdr") ==<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>        
</span>XRayLogRegisterStatus::XRAY_REGISTRATION_OK);<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>auto status =<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>     
</span>__xray_log_init_mode("xray-fdr",
"buffer_size=16384:buffer_max=10");<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>assert(status ==
XRayLogInitStatus::XRAY_LOG_INITIALIZED);<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>std::cout <<
"Init status " << status << std::endl;<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>// CHECK: Init
status {{.*}}<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>std::cout <<
"Patching..." << std::endl;<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>// CHECK:
Patching...<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>__xray_patch();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>fA();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>fC();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>fB();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>fA();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>fC();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>std::thread
other_thread([]() {<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>    </span>fC();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>    </span>fB();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>    </span>fA();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>    </span>fArg(1);<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>});<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>other_thread.join();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>std::cout <<
"Joined" << std::endl;<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>// CHECK: Joined<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>std::cout <<
"Finalize status " << __xray_log_finalize() << std::endl;<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>// CHECK: Finalize
status {{.*}}<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>//fC();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>std::cout <<
"Main execution var = " << var << std::endl;<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>// CHECK: Main
execution var = 6<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>std::cout <<
"Flush status " << __xray_log_flushLog() << std::endl;<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>// CHECK: Flush
status {{.*}}<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>__xray_unpatch();<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>return 0;<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">}<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// Check that we're able to see two threads, each entering
and exiting fA().<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE-DAG: - { type: 0, func-id: [[FIDA:[0-9]+]],
function: {{.*fA.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], kind:
function-enter, tsc: {{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE:<span>     </span>- {
type: 0, func-id: [[FIDA]], function: {{.*fA.*}}, cpu: {{.*}}, thread:
[[THREAD1]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE-DAG: - { type: 0, func-id: [[FIDA]], function:
{{.*fA.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], kind: function-enter, tsc:
{{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE:<span>     </span>- {
type: 0, func-id: [[FIDA]], function: {{.*fA.*}}, cpu: {{.*}}, thread:
[[THREAD2]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">//<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// Do the same as above for fC()<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE-DAG: - { type: 0, func-id: [[FIDC:[0-9]+]],
function: {{.*fC.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], kind:
function-enter, tsc: {{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE:<span>     </span>- {
type: 0, func-id: [[FIDC]], function: {{.*fC.*}}, cpu: {{.*}}, thread:
[[THREAD1]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE-DAG: - { type: 0, func-id: [[FIDC]], function:
{{.*fC.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], kind: function-enter, tsc:
{{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE:<span>     </span>- {
type: 0, func-id: [[FIDC]], function: {{.*fC.*}}, cpu: {{.*}}, thread:
[[THREAD2]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// Do the same as above for fB()<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE-DAG: - { type: 0, func-id: [[FIDB:[0-9]+]],
function: {{.*fB.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], kind:
function-enter, tsc: {{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE:<span>     </span>- {
type: 0, func-id: [[FIDB]], function: {{.*fB.*}}, cpu: {{.*}}, thread:
[[THREAD1]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE-DAG: - { type: 0, func-id: [[FIDB]], function:
{{.*fB.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], kind: function-enter, tsc:
{{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE:<span>     </span>- {
type: 0, func-id: [[FIDB]], function: {{.*fB.*}}, cpu: {{.*}}, thread:
[[THREAD2]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE-DAG: - { type: 0, func-id: [[FIDARG:[0-9]+]],
function: 'fArg(int)', args: [ 1 ], cpu: {{.*}}, thread: [[THREAD2]], kind: function-enter-arg,
tsc: {{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// TRACE-DAG: - { type: 0, func-id: [[FIDARG]], function:
'fArg(int)', cpu: {{.*}}, thread: [[THREAD2]], kind: function-exit, tsc:
{{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// Assert that when unwriting is enabled with a high
threshold time, all the function records are erased. A CPU switch could
erroneously fail this test, but<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// is unlikely given the test program.<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// Even with a high threshold, arg1 logging is never
unwritten.<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// UNWRITE: header:<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// UNWRITE: records:<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// UNWRITE-NEXT: - { type: 0, func-id: [[FIDARG:[0-9]+]],
function: 'fArg(int)', args: [ 1 ], cpu: {{.*}}, thread: [[THREAD2:[0-9]+]],
kind: function-enter-arg, tsc: {{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// UNWRITE-NEXT: - { type: 0, func-id: [[FIDARG]], function:
'fArg(int)', cpu: {{.*}}, thread: [[THREAD2]], kind: function-exit, tsc:
{{[0-9]+}} }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// UNWRITE-NOT: function-enter<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">// UNWRITE-NOT: function-{{exit|tail-exit}}<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">henry@OptiPlex-9010:~/build_xray/llvm-instrumented-build/bin$
./clang++ -fxray-instrument fdr-mode.cc -o fdr-mode<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">henry@OptiPlex-9010:~/build_xray/llvm-instrumented-build/bin$
XRAY_OPTIONS="patch_premain=false xray_mode=xray-fdr verbosity=1" XRAY_FDR_OPTIONS="func_duration_threshold_us=0"
./fdr-mode<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Logging before init.<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">==31823==Initializing FDR mode with options:
buffer_size=16384:buffer_max=10<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">==31823==XRay FDR init successful.<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Init status 2<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Patching...<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Joined<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Finalize status 4<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Main execution var = 5<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">==31823==XRay: Log file in 'xray-log.fdr-mode.2RGxtt'<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Flush status 2<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">henry@OptiPlex-9010:~/build_xray/llvm-instrumented-build/bin$
./llvm-xray convert<span>  </span>-f yaml -symbolize -instr_map=./fdr-mode
xray-log.fdr-mode.2RGxtt<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">---<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">header:<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>version:<span>         </span>2<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>type:<span>            </span>1<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>constant-tsc:<span>    </span>true<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>nonstop-tsc:<span>     </span>true<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>cycle-frequency:
3400000000<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">records:<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352650592 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352650592 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352656724 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352656724 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352657480 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352657480 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352657936 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352657936 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352658164 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352658164 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352658432 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352658432 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 3, function: 'fA()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352658748 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 3, function: 'fA()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352658748 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352659040 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352659040 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352659288 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-enter, tsc:
4956245352659288 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352659516 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 1, function: 'fC()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352659516 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352659796 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 2, function: 'fB()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352659796 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 3, function: 'fA()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352660052 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 3, function: 'fA()', cpu: 3, thread: 31824, kind: function-exit, tsc:
4956245352660052 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 4, function: 'fArg(int)', args: [ 1 ], cpu: 3, thread: 31824, kind:
function-enter-arg, tsc: 4956245352661192 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 4, function: 'fArg(int)', args: [ 1 ], cpu: 3, thread: 31824, kind:
function-enter-arg, tsc: 4956245352661192 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 4, function: 'fArg(int)', cpu: 3, thread: 31824, kind: function-exit,
tsc: 4956245352663520 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span>  </span>- { type: 0,
func-id: 4, function: 'fArg(int)', cpu: 3, thread: 31824, kind: function-exit,
tsc: 4956245352663520 }<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">...<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">The logger reports “==31823==XRay: Log file in
'xray-log.fdr-mode.2RGxtt'”, but there’s no TID associated with the main thread
in the trace compared to the trace generated with the call to fC().<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Is this expected behavior? <span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> <br><br>I have included the file as an attachment below.<br><br></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Thanks,<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Henry<span></span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>





<br></div>