[llvm] [LLVM][MC] Add tracing support to llvm-mc to measure decode times (PR #151149)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 09:33:18 PDT 2025


================
@@ -371,6 +391,22 @@ int main(int argc, char **argv) {
 
   cl::HideUnrelatedOptions({&MCCategory, &getColorCategory()});
   cl::ParseCommandLineOptions(argc, argv, "llvm machine code playground\n");
+
+  if (TimeTrace)
+    timeTraceProfilerInitialize(TimeTraceGranularity, argv[0]);
+
+  auto TimeTraceScopeExit = make_scope_exit([]() {
+    if (!TimeTrace)
+      return;
+    if (auto E = timeTraceProfilerWrite(TimeTraceFile, OutputFilename)) {
+      handleAllErrors(std::move(E), [&](const StringError &SE) {
+        errs() << SE.getMessage() << "\n";
+      });
+      return;
+    }
----------------
mshockwave wrote:

maybe `logAllUnhandledErrors`?

https://github.com/llvm/llvm-project/pull/151149


More information about the llvm-commits mailing list