[snapshot] Fix the Memory.json benchmark
.. which traces various stats (time, memory) related to the snapshot. Due to various flag shuffles, it was broken as of Oct 2020, with some line items reporting constant 0. This also refactors --profile-deserialization and --serialization-statistics s.t. the former only reports deserialization times and the latter reports memory. Memory.json now passes both flags. Change-Id: I7dacbbbe9f7a667e0802d0f7a44703dc34524a4e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2854742 Auto-Submit: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#74241}
This commit is contained in:
parent
373d42a245
commit
f5594f50ac
@ -897,7 +897,7 @@ RUNTIME_FUNCTION(Runtime_ProfileCreateSnapshotDataBlob) {
|
||||
// Used only by the test/memory/Memory.json benchmark. This creates a snapshot
|
||||
// blob and outputs various statistics around it.
|
||||
|
||||
DCHECK(FLAG_profile_deserialization);
|
||||
DCHECK(FLAG_profile_deserialization && FLAG_serialization_statistics);
|
||||
|
||||
DisableEmbeddedBlobRefcounting();
|
||||
|
||||
|
@ -459,10 +459,9 @@ void EmbeddedData::PrintStatistics() const {
|
||||
const int k99th = kCount * 0.99;
|
||||
|
||||
PrintF("EmbeddedData:\n");
|
||||
PrintF(" Total size: %d\n",
|
||||
PrintF(" Total size: %d\n",
|
||||
static_cast<int>(code_size() + data_size()));
|
||||
PrintF(" Data size: %d\n",
|
||||
static_cast<int>(data_size()));
|
||||
PrintF(" Data size: %d\n", static_cast<int>(data_size()));
|
||||
PrintF(" Code size: %d\n", static_cast<int>(code_size()));
|
||||
PrintF(" Instruction size (50th percentile): %d\n", sizes[k50th]);
|
||||
PrintF(" Instruction size (75th percentile): %d\n", sizes[k75th]);
|
||||
|
@ -155,7 +155,7 @@ v8::StartupData CreateSnapshotDataBlob(v8::Isolate* isolate,
|
||||
isolate);
|
||||
|
||||
if (i::FLAG_profile_deserialization) {
|
||||
i::PrintF("Creating snapshot took %0.3f ms\n",
|
||||
i::PrintF("[Creating snapshot took %0.3f ms]\n",
|
||||
timer.Elapsed().InMillisecondsF());
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ v8::StartupData Snapshot::Create(
|
||||
context_serializer.Serialize(&contexts->at(i), no_gc);
|
||||
can_be_rehashed = can_be_rehashed && context_serializer.can_be_rehashed();
|
||||
context_snapshots.push_back(new SnapshotData(&context_serializer));
|
||||
if (FLAG_profile_deserialization) {
|
||||
if (FLAG_serialization_statistics) {
|
||||
context_allocation_sizes.push_back(
|
||||
context_serializer.TotalAllocationSize());
|
||||
}
|
||||
@ -372,15 +372,19 @@ v8::StartupData Snapshot::Create(
|
||||
read_only_serializer.FinalizeSerialization();
|
||||
can_be_rehashed = can_be_rehashed && read_only_serializer.can_be_rehashed();
|
||||
|
||||
if (FLAG_profile_deserialization) {
|
||||
if (FLAG_serialization_statistics) {
|
||||
// These prints should match the regexp in test/memory/Memory.json
|
||||
DCHECK_NE(read_only_serializer.TotalAllocationSize(), 0);
|
||||
DCHECK_NE(startup_serializer.TotalAllocationSize(), 0);
|
||||
PrintF("Deserialization will allocate:\n");
|
||||
PrintF("%10d bytes per isolate\n",
|
||||
read_only_serializer.TotalAllocationSize() +
|
||||
startup_serializer.TotalAllocationSize());
|
||||
for (int i = 0; i < num_contexts; i++) {
|
||||
DCHECK_NE(context_allocation_sizes[i], 0);
|
||||
PrintF("%10d bytes per context #%d\n", context_allocation_sizes[i], i);
|
||||
}
|
||||
PrintF("\n");
|
||||
}
|
||||
|
||||
SnapshotData read_only_snapshot(&read_only_serializer);
|
||||
@ -469,7 +473,7 @@ v8::StartupData SnapshotImpl::CreateSnapshotBlob(
|
||||
CopyBytes(data + payload_offset,
|
||||
reinterpret_cast<const char*>(startup_snapshot->RawData().begin()),
|
||||
payload_length);
|
||||
if (FLAG_profile_deserialization) {
|
||||
if (FLAG_serialization_statistics) {
|
||||
PrintF("Snapshot blob consists of:\n%10d bytes for startup\n",
|
||||
payload_length);
|
||||
}
|
||||
@ -483,7 +487,7 @@ v8::StartupData SnapshotImpl::CreateSnapshotBlob(
|
||||
data + payload_offset,
|
||||
reinterpret_cast<const char*>(read_only_snapshot->RawData().begin()),
|
||||
payload_length);
|
||||
if (FLAG_profile_deserialization) {
|
||||
if (FLAG_serialization_statistics) {
|
||||
PrintF("%10d bytes for read-only\n", payload_length);
|
||||
}
|
||||
payload_offset += payload_length;
|
||||
@ -498,11 +502,12 @@ v8::StartupData SnapshotImpl::CreateSnapshotBlob(
|
||||
data + payload_offset,
|
||||
reinterpret_cast<const char*>(context_snapshot->RawData().begin()),
|
||||
payload_length);
|
||||
if (FLAG_profile_deserialization) {
|
||||
if (FLAG_serialization_statistics) {
|
||||
PrintF("%10d bytes for context #%d\n", payload_length, i);
|
||||
}
|
||||
payload_offset += payload_length;
|
||||
}
|
||||
if (FLAG_serialization_statistics) PrintF("\n");
|
||||
|
||||
DCHECK_EQ(total_length, payload_offset);
|
||||
v8::StartupData result = {data, static_cast<int>(total_length)};
|
||||
|
@ -6,7 +6,8 @@
|
||||
"resources": ["run.js"],
|
||||
"main": "run.js",
|
||||
"path": ["."],
|
||||
"flags": ["--allow-natives-syntax", "--profile-deserialization"],
|
||||
"flags": ["--allow-natives-syntax", "--profile-deserialization",
|
||||
"--serialization-statistics"],
|
||||
"tests": [
|
||||
{
|
||||
"name": "ReservedMemoryIsolate",
|
||||
|
Loading…
Reference in New Issue
Block a user