[llvm] r345905 - [XRay] Fix TSC and atomic custom/typed event accounting

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 1 15:57:51 PDT 2018


Author: dberris
Date: Thu Nov  1 15:57:50 2018
New Revision: 345905

URL: http://llvm.org/viewvc/llvm-project?rev=345905&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/XRay/FDRRecordProducer.cpp

Modified: llvm/trunk/lib/XRay/FDRRecordProducer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/XRay/FDRRecordProducer.cpp?rev=345905&r1=345904&r2=345905&view=diff
==============================================================================
--- llvm/trunk/lib/XRay/FDRRecordProducer.cpp (original)
+++ llvm/trunk/lib/XRay/FDRRecordProducer.cpp Thu Nov  1 15:57:50 2018
@@ -84,6 +84,12 @@ Expected<std::unique_ptr<Record>> FileBa
   // the rest of the bytes.
   auto PreReadOffset = OffsetPtr;
   uint8_t FirstByte = E.getU8(&OffsetPtr);
+  if (OffsetPtr == PreReadOffset)
+    return createStringError(
+        std::make_error_code(std::errc::executable_format_error),
+        "Failed reading one byte from offset %d.", OffsetPtr);
+
+  // Set up our result record.
   std::unique_ptr<Record> R;
 
   // For metadata records, handle especially here.




More information about the llvm-commits mailing list