[PATCH] D40828: [XRay][compiler-rt] Implement XRay Basic Mode Filtering

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 00:20:06 PST 2017


dberris created this revision.

This change implements the basic mode filtering similar to what we do in
FDR mode. The implementation is slightly simpler in basic-mode filtering
because we have less details to remember, but the idea is the same. At a
high level, we do the following to decide when to filter function call
records:

- We maintain a per-thread "shadow stack" which keeps track of the XRay instrumented functions we've encountered in a thread's execution.
- We push an entry onto the stack when we enter an XRay instrumented function, and note the CPU, TSC, and type of entry (whether we have payload or not when entering).
- When we encounter an exit event, we determine whether the function being exited is the same function we've entered recently, was executing in the same CPU, and the delta of the recent TSC and the recorded TSC at the top of the stack is less than the equivalent amount of microseconds we're configured to ignore -- then we un-wind the record offset an appropriate number of times (so we can overwrite the records later).

We also support limiting the stack depth of the recorded functions,
so that we don't arbitrarily write deep function call stacks.


https://reviews.llvm.org/D40828

Files:
  compiler-rt/lib/xray/xray_inmemory_log.cc
  compiler-rt/test/xray/TestCases/Linux/basic-filtering.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40828.125476.patch
Type: text/x-patch
Size: 13945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171205/87b1dc6a/attachment.bin>


More information about the llvm-commits mailing list