Skip to content

Commit cef53fb

Browse files
committed
EISW-163565 [Cleanup] Revert "Expose TimingManager OutputTextStrategy"
This reverts commit 7ce2622.
1 parent 9668fe3 commit cef53fb

File tree

2 files changed

+47
-48
lines changed

2 files changed

+47
-48
lines changed

mlir/include/mlir/Support/Timing.h

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "llvm/ADT/STLExtras.h"
1818
#include "llvm/ADT/StringMapEntry.h"
1919
#include "llvm/Support/raw_ostream.h"
20-
#include "llvm/Support/Format.h"
2120
#include <optional>
2221

2322
namespace mlir {
@@ -368,53 +367,6 @@ class OutputStrategy {
368367
raw_ostream &os;
369368
};
370369

371-
constexpr llvm::StringLiteral kTimingDescription =
372-
"... Execution time report ...";
373-
374-
class OutputTextStrategy : public OutputStrategy {
375-
public:
376-
OutputTextStrategy(raw_ostream &os) : OutputStrategy(os) {}
377-
378-
void printHeader(const TimeRecord &total) override {
379-
// Figure out how many spaces to description name.
380-
unsigned padding = (80 - kTimingDescription.size()) / 2;
381-
os << "===" << std::string(73, '-') << "===\n";
382-
os.indent(padding) << kTimingDescription << '\n';
383-
os << "===" << std::string(73, '-') << "===\n";
384-
385-
// Print the total time followed by the section headers.
386-
os << llvm::format(" Total Execution Time: %.4f seconds\n\n", total.wall);
387-
if (total.user != total.wall)
388-
os << " ----User Time----";
389-
os << " ----Wall Time---- ----Name----\n";
390-
}
391-
392-
void printFooter() override { os.flush(); }
393-
394-
void printTime(const TimeRecord &time, const TimeRecord &total) override {
395-
if (total.user != total.wall) {
396-
os << llvm::format(" %8.4f (%5.1f%%)", time.user,
397-
100.0 * time.user / total.user);
398-
}
399-
os << llvm::format(" %8.4f (%5.1f%%) ", time.wall,
400-
100.0 * time.wall / total.wall);
401-
}
402-
403-
void printListEntry(StringRef name, const TimeRecord &time,
404-
const TimeRecord &total, bool lastEntry) override {
405-
printTime(time, total);
406-
os << name << "\n";
407-
}
408-
409-
void printTreeEntry(unsigned indent, StringRef name, const TimeRecord &time,
410-
const TimeRecord &total) override {
411-
printTime(time, total);
412-
os.indent(indent) << name << "\n";
413-
}
414-
415-
void printTreeEntryEnd(unsigned indent, bool lastEntry) override {}
416-
};
417-
418370
//===----------------------------------------------------------------------===//
419371
// DefaultTimingManager
420372
//===----------------------------------------------------------------------===//

mlir/lib/Support/Timing.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ using namespace detail;
3434
using DisplayMode = DefaultTimingManager::DisplayMode;
3535
using OutputFormat = DefaultTimingManager::OutputFormat;
3636

37+
constexpr llvm::StringLiteral kTimingDescription =
38+
"... Execution time report ...";
39+
3740
//===----------------------------------------------------------------------===//
3841
// TimingManager
3942
//===----------------------------------------------------------------------===//
@@ -107,6 +110,50 @@ TimingIdentifier TimingIdentifier::get(StringRef str, TimingManager &tm) {
107110

108111
namespace {
109112

113+
class OutputTextStrategy : public OutputStrategy {
114+
public:
115+
OutputTextStrategy(raw_ostream &os) : OutputStrategy(os) {}
116+
117+
void printHeader(const TimeRecord &total) override {
118+
// Figure out how many spaces to description name.
119+
unsigned padding = (80 - kTimingDescription.size()) / 2;
120+
os << "===" << std::string(73, '-') << "===\n";
121+
os.indent(padding) << kTimingDescription << '\n';
122+
os << "===" << std::string(73, '-') << "===\n";
123+
124+
// Print the total time followed by the section headers.
125+
os << llvm::format(" Total Execution Time: %.4f seconds\n\n", total.wall);
126+
if (total.user != total.wall)
127+
os << " ----User Time----";
128+
os << " ----Wall Time---- ----Name----\n";
129+
}
130+
131+
void printFooter() override { os.flush(); }
132+
133+
void printTime(const TimeRecord &time, const TimeRecord &total) override {
134+
if (total.user != total.wall) {
135+
os << llvm::format(" %8.4f (%5.1f%%)", time.user,
136+
100.0 * time.user / total.user);
137+
}
138+
os << llvm::format(" %8.4f (%5.1f%%) ", time.wall,
139+
100.0 * time.wall / total.wall);
140+
}
141+
142+
void printListEntry(StringRef name, const TimeRecord &time,
143+
const TimeRecord &total, bool lastEntry) override {
144+
printTime(time, total);
145+
os << name << "\n";
146+
}
147+
148+
void printTreeEntry(unsigned indent, StringRef name, const TimeRecord &time,
149+
const TimeRecord &total) override {
150+
printTime(time, total);
151+
os.indent(indent) << name << "\n";
152+
}
153+
154+
void printTreeEntryEnd(unsigned indent, bool lastEntry) override {}
155+
};
156+
110157
class OutputJsonStrategy : public OutputStrategy {
111158
public:
112159
OutputJsonStrategy(raw_ostream &os) : OutputStrategy(os) {}

0 commit comments

Comments
 (0)