[XRay] Fix TSC and atomic custom/typed event accounting
authorDean Michael Berris <dberris@google.com>
Thu, 1 Nov 2018 22:57:50 +0000 (22:57 +0000)
committerDean Michael Berris <dberris@google.com>
Thu, 1 Nov 2018 22:57:50 +0000 (22:57 +0000)
commite8c650ab126bc67cc4dffa0b8671c635079fc786
tree003cd2f7983c9061f0f1d64de7301025a69eee99
parent0857df38bd3cbff4c30cb1bc4366afacd3cc973d
[XRay] Fix TSC and atomic custom/typed event accounting

Summary:
This is a follow-on change to D53858 which turns out to have had a TSC
accounting bug when writing out function exit records in FDR mode.

This change adds a number of tests to ensure that:

- We are handling the delta between the exit TSC and the last TSC we've
  seen.

- We are writing the custom event and typed event records as a single
  update to the buffer extents.

- We are able to catch boundary conditions when loading FDR logs.

We introduce a TSC matcher to the test helpers, which we use in the
testing/verification of the TSC accounting change.

Reviewers: mboerger

Subscribers: mgorny, hiraditya, jfb, llvm-commits

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

llvm-svn: 345905
compiler-rt/lib/xray/tests/CMakeLists.txt
compiler-rt/lib/xray/tests/unit/fdr_controller_test.cc
compiler-rt/lib/xray/tests/unit/fdr_log_writer_test.cc
compiler-rt/lib/xray/tests/unit/test_helpers.h
compiler-rt/lib/xray/xray_fdr_controller.h
compiler-rt/lib/xray/xray_fdr_log_writer.h
llvm/lib/XRay/FDRRecordProducer.cpp