summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/XRay/BlockIndexer.cpp25
-rw-r--r--llvm/lib/XRay/Trace.cpp3
2 files changed, 7 insertions, 21 deletions
diff --git a/llvm/lib/XRay/BlockIndexer.cpp b/llvm/lib/XRay/BlockIndexer.cpp
index e1c554aff73..98e91f7de54 100644
--- a/llvm/lib/XRay/BlockIndexer.cpp
+++ b/llvm/lib/XRay/BlockIndexer.cpp
@@ -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 &R) {
}
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();
}
diff --git a/llvm/lib/XRay/Trace.cpp b/llvm/lib/XRay/Trace.cpp
index 1a04b18ad9f..15cafa51bec 100644
--- a/llvm/lib/XRay/Trace.cpp
+++ b/llvm/lib/XRay/Trace.cpp
@@ -289,16 +289,15 @@ Error loadFDRLog(StringRef Data, bool IsLittleEndian,
// 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();
}
}
}
OpenPOWER on IntegriCloud