diff --git a/include/llvm/Support/TimeProfiler.h b/include/llvm/Support/TimeProfiler.h index 2b51bba0e7f..678f8c13681 100644 --- a/include/llvm/Support/TimeProfiler.h +++ b/include/llvm/Support/TimeProfiler.h @@ -58,6 +58,10 @@ struct TimeTraceScope { TimeTraceScope(TimeTraceScope &&) = delete; TimeTraceScope &operator=(TimeTraceScope &&) = delete; + TimeTraceScope(StringRef Name) { + if (TimeTraceProfilerInstance != nullptr) + timeTraceProfilerBegin(Name, StringRef("")); + } TimeTraceScope(StringRef Name, StringRef Detail) { if (TimeTraceProfilerInstance != nullptr) timeTraceProfilerBegin(Name, Detail); diff --git a/lib/Support/TimeProfiler.cpp b/lib/Support/TimeProfiler.cpp index 6c993387e59..a7c85509064 100644 --- a/lib/Support/TimeProfiler.cpp +++ b/lib/Support/TimeProfiler.cpp @@ -123,7 +123,9 @@ struct TimeTraceProfiler { J.attribute("ts", StartUs); J.attribute("dur", DurUs); J.attribute("name", E.Name); - J.attributeObject("args", [&] { J.attribute("detail", E.Detail); }); + if (!E.Detail.empty()) { + J.attributeObject("args", [&] { J.attribute("detail", E.Detail); }); + } }); }