[PATCH] D60792: Time profiler: optimize json output time
Anton Afanasyev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 16 13:36:11 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL358522: Time profiler: optimize json output time (authored by anton-afanasyev, committed by ).
Herald added a subscriber: kristina.
Changed prior to commit:
https://reviews.llvm.org/D60792?vs=195447&id=195450#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60792/new/
https://reviews.llvm.org/D60792
Files:
llvm/trunk/lib/Support/TimeProfiler.cpp
Index: llvm/trunk/lib/Support/TimeProfiler.cpp
===================================================================
--- llvm/trunk/lib/Support/TimeProfiler.cpp
+++ llvm/trunk/lib/Support/TimeProfiler.cpp
@@ -89,6 +89,9 @@
"All profiler sections should be ended when calling Write");
json::Array Events;
+ const size_t ExpectedEntryCount =
+ Entries.size() + CountAndTotalPerName.size() + 1;
+ Events.reserve(ExpectedEntryCount);
// Emit all events for the main flame graph.
for (const auto &E : Entries) {
@@ -149,6 +152,8 @@
{"args", json::Object{{"name", "clang"}}},
});
+ assert(Events.size() == ExpectedEntryCount && "Size prediction failed!");
+
OS << formatv("{0:2}", json::Value(json::Object(
{{"traceEvents", std::move(Events)}})));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60792.195450.patch
Type: text/x-patch
Size: 845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190416/087e4c4b/attachment.bin>
More information about the llvm-commits
mailing list