[llvm] r342122 - [XRay] Bug fixes for FDR custom event and arg-logging
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 13 02:25:43 PDT 2018
Author: dberris
Date: Thu Sep 13 02:25:42 2018
New Revision: 342122
URL: http://llvm.org/viewvc/llvm-project?rev=342122&view=rev
Log:
[XRay] Bug fixes for FDR custom event and arg-logging
Summary:
This change has a number of fixes for FDR mode in compiler-rt along with
changes to the tooling handling the traces in llvm.
In the runtime, we do the following:
- Advance the "last record" pointer appropriately when writing the
custom event data in the log.
- Add XRAY_NEVER_INSTRUMENT in the rewinding routine.
- When collecting the argument of functions appropriately marked, we
should not attempt to rewind them (and reset the counts of functions
that can be re-wound).
In the tooling, we do the following:
- Remove the state logic in BlockIndexer and instead rely on the
presence/absence of records to indicate blocks.
- Move the verifier into a loop associated with each block.
Reviewers: mboerger, eizan
Subscribers: llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D51965
Modified:
llvm/trunk/include/llvm/XRay/BlockIndexer.h
llvm/trunk/lib/XRay/BlockIndexer.cpp
llvm/trunk/lib/XRay/Trace.cpp
Modified: llvm/trunk/include/llvm/XRay/BlockIndexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/XRay/BlockIndexer.h?rev=342122&r1=342121&r2=342122&view=diff
==============================================================================
--- llvm/trunk/include/llvm/XRay/BlockIndexer.h (original)
+++ llvm/trunk/include/llvm/XRay/BlockIndexer.h Thu Sep 13 02:25:42 2018
@@ -39,9 +39,6 @@ public:
private:
Index &Indices;
- enum class State : unsigned { SeekExtents, ExtentsFound, ThreadIDFound };
-
- State CurrentState = State::SeekExtents;
Block CurrentBlock{0, 0, nullptr, {}};
public:
Modified: llvm/trunk/lib/XRay/BlockIndexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/XRay/BlockIndexer.cpp?rev=342122&r1=342121&r2=342122&view=diff
==============================================================================
--- llvm/trunk/lib/XRay/BlockIndexer.cpp (original)
+++ llvm/trunk/lib/XRay/BlockIndexer.cpp Thu Sep 13 02:25:42 2018
@@ -16,22 +16,7 @@
namespace llvm {
namespace xray {
-Error BlockIndexer::visit(BufferExtents &) {
- if (CurrentState == State::ThreadIDFound) {
- Index::iterator It;
- std::tie(It, std::ignore) =
- Indices.insert({{CurrentBlock.ProcessID, CurrentBlock.ThreadID}, {}});
- It->second.push_back({CurrentBlock.ProcessID, CurrentBlock.ThreadID,
- CurrentBlock.WallclockTime,
- std::move(CurrentBlock.Records)});
- CurrentBlock.ProcessID = 0;
- CurrentBlock.ThreadID = 0;
- CurrentBlock.WallclockTime = nullptr;
- CurrentBlock.Records = {};
- }
- CurrentState = State::ExtentsFound;
- return Error::success();
-}
+Error BlockIndexer::visit(BufferExtents &) { return Error::success(); }
Error BlockIndexer::visit(WallclockRecord &R) {
CurrentBlock.Records.push_back(&R);
@@ -66,14 +51,16 @@ Error BlockIndexer::visit(PIDRecord &R)
}
Error BlockIndexer::visit(NewBufferRecord &R) {
- CurrentState = State::ThreadIDFound;
+ if (!CurrentBlock.Records.empty())
+ if (auto E = flush())
+ return E;
+
CurrentBlock.ThreadID = R.tid();
CurrentBlock.Records.push_back(&R);
return Error::success();
}
Error BlockIndexer::visit(EndBufferRecord &R) {
- CurrentState = State::SeekExtents;
CurrentBlock.Records.push_back(&R);
return Error::success();
}
@@ -84,7 +71,6 @@ Error BlockIndexer::visit(FunctionRecord
}
Error BlockIndexer::flush() {
- CurrentState = State::SeekExtents;
Index::iterator It;
std::tie(It, std::ignore) =
Indices.insert({{CurrentBlock.ProcessID, CurrentBlock.ThreadID}, {}});
@@ -94,6 +80,7 @@ Error BlockIndexer::flush() {
CurrentBlock.ProcessID = 0;
CurrentBlock.ThreadID = 0;
CurrentBlock.Records = {};
+ CurrentBlock.WallclockTime = nullptr;
return Error::success();
}
Modified: llvm/trunk/lib/XRay/Trace.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/XRay/Trace.cpp?rev=342122&r1=342121&r2=342122&view=diff
==============================================================================
--- llvm/trunk/lib/XRay/Trace.cpp (original)
+++ llvm/trunk/lib/XRay/Trace.cpp Thu Sep 13 02:25:42 2018
@@ -289,16 +289,15 @@ Error loadFDRLog(StringRef Data, bool Is
// Then we verify the consistency of the blocks.
{
- BlockVerifier Verifier;
for (auto &PTB : Index) {
auto &Blocks = PTB.second;
for (auto &B : Blocks) {
+ BlockVerifier Verifier;
for (auto *R : B.Records)
if (auto E = R->apply(Verifier))
return E;
if (auto E = Verifier.verify())
return E;
- Verifier.reset();
}
}
}
More information about the llvm-commits
mailing list