Commit 0a7c55b4 authored by Etienne Bergeron's avatar Etienne Bergeron Committed by Commit Bot

Fix incorrect computation of size exported to JSON traces.

The outputted size is not the size of each allocation, but the sum of
every allocation for a given stackframe.

R=erikchen@chromium.org

Bug: 753514
Change-Id: I1840f89d06a63e5f30af66da080ef7ea91d1715a
Reviewed-on: https://chromium-review.googlesource.com/664250Reviewed-by: default avatarErik Chen <erikchen@chromium.org>
Reviewed-by: default avatarBrett Wilson <brettw@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501465}
parent 3c495029
......@@ -276,7 +276,8 @@ void WriteSizes(const UniqueAllocCount& alloc_counts, std::ostream& out) {
out << ",\n";
else
first_time = false;
out << cur.first.size;
// Output the total size, which is size * count.
out << cur.first.size * cur.second;
}
out << "]";
}
......
......@@ -375,7 +375,7 @@ TEST(ProfilingJsonExporterTest, Simple) {
// Validate node allocated with |stack1|.
EXPECT_EQ(2, counts->GetList()[node1].GetInt());
EXPECT_EQ(0, types->GetList()[node1].GetInt());
EXPECT_EQ(20, sizes->GetList()[node1].GetInt());
EXPECT_EQ(40, sizes->GetList()[node1].GetInt());
EXPECT_EQ(id1, backtraces->GetList()[node1].GetInt());
// Validate node allocated with |stack2|.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment