mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-01 07:11:45 +00:00
[Support] Add TimeTraceScope constructor without detail arg
This simplifies code where no extra details are required Also don't write out detail when it is empty. Differential Revision: https://reviews.llvm.org/D71347
This commit is contained in:
parent
412c0530f5
commit
cbf7c89369
@ -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);
|
||||
|
@ -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); });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user