Add flag for printing the time it took to deserialize the snapshot.

BUG=
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/25695002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17072 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
olivf@chromium.org 2013-10-02 11:32:19 +00:00
parent f454b45d6d
commit 60c92b9b9a
2 changed files with 15 additions and 1 deletions

View File

@ -595,6 +595,11 @@ DEFINE_int(hash_seed,
"Fixed seed to use to hash property keys (0 means random)"
"(with snapshots this option cannot override the baked-in seed)")
// snapshot-common.cc
DEFINE_bool(profile_deserialization,
false,
"Print the time it takes to deserialize the snapshot.")
// v8.cc
DEFINE_bool(preemption, false,
"activate a 100ms timer that switches between V8 threads")

View File

@ -102,10 +102,19 @@ bool Snapshot::Initialize(const char* snapshot_file) {
DeleteArray(str);
return success;
} else if (size_ > 0) {
ElapsedTimer timer;
if (FLAG_profile_deserialization) {
timer.Start();
}
SnapshotByteSource source(raw_data_, raw_size_);
Deserializer deserializer(&source);
ReserveSpaceForLinkedInSnapshot(&deserializer);
return V8::Initialize(&deserializer);
bool success = V8::Initialize(&deserializer);
if (FLAG_profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
PrintF("[Snapshot loading and deserialization took %0.3f ms]\n", ms);
}
return success;
}
return false;
}