[XRay] [compiler-rt] Unwriting FDR mode buffers when functions are short.
authorDean Michael Berris <dberris@google.com>
Thu, 6 Apr 2017 07:14:43 +0000 (07:14 +0000)
committerDean Michael Berris <dberris@google.com>
Thu, 6 Apr 2017 07:14:43 +0000 (07:14 +0000)
commit895171e6eea4ffc9d2b25ca4151dfef268bc8148
tree21c0641c1736e9f4835c4320dffa2abb59f73c0f
parentfbe67da29b08e7e52e0074989f15b2fa4c3cad98
[XRay] [compiler-rt] Unwriting FDR mode buffers when functions are short.

Summary:
"short" is defined as an xray flag, and buffer rewinding happens for both exits
 and tail exits.

 I've made the choice to seek backwards finding pairs of FunctionEntry, TailExit
 record pairs and erasing them if the FunctionEntry occurred before exit from the
 currently exiting function. This is a compromise so that we don't skip logging
 tail calls if the function that they call into takes longer our duration.

 This works by counting the consecutive function and function entry, tail exit
 pairs that proceed the current point in the buffer. The buffer is rewound to
 check whether these entry points happened recently enough to be erased.

 It is still possible we will omit them if they call into a child function that
 is not instrumented which calls a fast grandchild that is instrumented before
 doing other processing.

Reviewers: pelikan, dberris

Reviewed By: dberris

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31345

llvm-svn: 299629
compiler-rt/lib/xray/xray_fdr_logging_impl.h
compiler-rt/lib/xray/xray_flags.inc
compiler-rt/test/xray/TestCases/Linux/fdr-mode.cc