[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:07:12 PDT 2019
anton-afanasyev updated this revision to Diff 195441.
anton-afanasyev added a comment.
Updated
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60792/new/
https://reviews.llvm.org/D60792
Files:
llvm/lib/Support/TimeProfiler.cpp
Index: llvm/lib/Support/TimeProfiler.cpp
===================================================================
--- llvm/lib/Support/TimeProfiler.cpp
+++ llvm/lib/Support/TimeProfiler.cpp
@@ -89,6 +89,7 @@
"All profiler sections should be ended when calling Write");
json::Array Events;
+ Events.reserve(Entries.size() + CountAndTotalPerName.size() + 1);
// Emit all events for the main flame graph.
for (const auto &E : Entries) {
@@ -149,6 +150,10 @@
{"args", json::Object{{"name", "clang"}}},
});
+ assert(
+ (Entries.size() + CountAndTotalPerName.size() + 1 == Events.size()) &&
+ "Events reserved size should be enough!");
+
OS << formatv("{0:2}", json::Value(json::Object(
{{"traceEvents", std::move(Events)}})));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60792.195441.patch
Type: text/x-patch
Size: 826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190416/0145ba9b/attachment.bin>
More information about the llvm-commits
mailing list