aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Support
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Support')
-rw-r--r--mlir/lib/Support/Timing.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/mlir/lib/Support/Timing.cpp b/mlir/lib/Support/Timing.cpp
index fb6f82c..b0ac379 100644
--- a/mlir/lib/Support/Timing.cpp
+++ b/mlir/lib/Support/Timing.cpp
@@ -50,7 +50,8 @@ public:
llvm::sys::SmartRWMutex<true> identifierMutex;
/// A thread local cache of identifiers to reduce lock contention.
- ThreadLocalCache<llvm::StringMap<llvm::StringMapEntry<std::nullopt_t> *>>
+ ThreadLocalCache<
+ llvm::StringMap<llvm::StringMapEntry<llvm::EmptyStringSetTag> *>>
localIdentifierCache;
TimingManagerImpl() : identifiers(identifierAllocator) {}
@@ -319,7 +320,6 @@ public:
void mergeChildren(AsyncChildrenMap &&other) {
for (auto &thread : other) {
mergeChildren(std::move(thread.second));
- assert(thread.second.empty());
}
other.clear();
}
@@ -619,11 +619,17 @@ void mlir::applyDefaultTimingManagerCLOptions(DefaultTimingManager &tm) {
return;
tm.setEnabled(options->timing);
tm.setDisplayMode(options->displayMode);
+ tm.setOutput(createOutputStrategy(options->outputFormat, llvm::errs()));
+}
- std::unique_ptr<OutputStrategy> printer;
- if (options->outputFormat == OutputFormat::Text)
- printer = std::make_unique<OutputTextStrategy>(llvm::errs());
- else if (options->outputFormat == OutputFormat::Json)
- printer = std::make_unique<OutputJsonStrategy>(llvm::errs());
- tm.setOutput(std::move(printer));
+std::unique_ptr<OutputStrategy>
+mlir::createOutputStrategy(DefaultTimingManager::OutputFormat fmt,
+ raw_ostream &os) {
+ switch (fmt) {
+ case OutputFormat::Text:
+ return std::make_unique<OutputTextStrategy>(os);
+ case OutputFormat::Json:
+ return std::make_unique<OutputJsonStrategy>(os);
+ }
+ llvm_unreachable("Invalid output format");
}