[PATCH] D30850: [XRay] [compiler-rt] Refactor logic for xray fdr logging.

Keith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 10 14:31:09 PST 2017


kpw created this revision.
Herald added a subscriber: mgorny.

Separated the IO and the thread local storage state machine of logging
from the writing of log records once the contents are deterministic.

Finer granularity functions are provided as inline functions in the same
header such that stack does not grow due to the functions being separated.

An executable utility xray_fdr_log_printer is also implemented to use the
finest granularity functions to produce binary test data in the FDR format
with a relatively convenient text input.

For example, one can take a file with textual contents layed out in rows
and feed it to the binary to generate data that llvm-xray convert can then
read. This is a convenient way to build a test suite for llvm-xray convert
to ensure it's robust to the fdr format.

Example:

$cat myFile.txt
NewBuffer : { time = 2 , Tid=5}
NewCPU : { CPU =1 , TSC = 123}
Function : { FuncId = 5, TSCDelta = 3, EntryType = Entry }
Function : { FuncId = 5, TSCDelta = 5, EntryType = Exit}
TSCWrap : { TSC = 678 }
Function : { FuncId = 6, TSCDelta = 0, EntryType = Entry }
Function : { FuncId = 6, TSCDelta = 50, EntryType = Exit }
EOB : { }
$cat myFile.txt | ./bin/xray_fdr_log_printer > /tmp/binarydata.bin
$./bin/llvm-xray convert -output-format=yaml -output=- /tmp/binarydata.bin

yaml format comes out as expected.


https://reviews.llvm.org/D30850

Files:
  lib/xray/tests/unit/CMakeLists.txt
  lib/xray/tests/unit/xray_fdr_log_printer_tool.cc
  lib/xray/xray_fdr_log_records.h
  lib/xray/xray_fdr_logging.cc
  lib/xray/xray_fdr_logging.h
  lib/xray/xray_fdr_logging_impl.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30850.91417.patch
Type: text/x-patch
Size: 57795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170310/ef1c464f/attachment.bin>


More information about the llvm-commits mailing list