From 862307ccacac1bdb5d6c6fd16303172d36667e6f Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Wed, 4 Nov 2015 15:13:16 -0800 Subject: [PATCH] Output precompiled snapshot size. R=fschneider@google.com Review URL: https://codereview.chromium.org/1414083004 . --- runtime/vm/snapshot.cc | 9 +++++++++ runtime/vm/snapshot.h | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc index db09095cf5e..0bffe7ba051 100644 --- a/runtime/vm/snapshot.cc +++ b/runtime/vm/snapshot.cc @@ -1951,6 +1951,15 @@ void FullSnapshotWriter::WriteFullSnapshot() { if (snapshot_code_) { instructions_writer_->WriteAssembly(); instructions_snapshot_size_ = instructions_writer_->BytesWritten(); + + OS::Print("VMIsolate(CodeSize): %" Pd "\n", VmIsolateSnapshotSize()); + OS::Print("Isolate(CodeSize): %" Pd "\n", IsolateSnapshotSize()); + OS::Print("Instructions(CodeSize): %" Pd "\n", + instructions_writer_->binary_size()); + intptr_t total = VmIsolateSnapshotSize() + + IsolateSnapshotSize() + + instructions_writer_->binary_size(); + OS::Print("Total(CodeSize): %" Pd "\n", total); } } diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h index a95e28ebfda..51cf5caa98e 100644 --- a/runtime/vm/snapshot.h +++ b/runtime/vm/snapshot.h @@ -804,14 +804,17 @@ class InstructionsWriter : public ZoneAllocated { intptr_t initial_size) : stream_(buffer, alloc, initial_size), next_offset_(InstructionsSnapshot::kHeaderSize), + binary_size_(0), instructions_() { ASSERT(buffer != NULL); ASSERT(alloc != NULL); } - // Size of the snapshot. + // Size of the snapshot (assembly code). intptr_t BytesWritten() const { return stream_.bytes_written(); } + intptr_t binary_size() { return binary_size_; } + int32_t GetOffsetFor(RawInstructions* instructions); void SetInstructionsCode(RawInstructions* insns, RawCode* code) { @@ -848,10 +851,12 @@ class InstructionsWriter : public ZoneAllocated { #else stream_.Print(".long 0x%0.8" Px "\n", value); #endif + binary_size_ += sizeof(value); } WriteStream stream_; intptr_t next_offset_; + intptr_t binary_size_; GrowableArray instructions_; DISALLOW_COPY_AND_ASSIGN(InstructionsWriter);