dart-sdk/runtime/vm/timer.cc
Alexander Markov 1d5b9ed046 [vm/aot] Remove PatchGlobalObjectPool step from AOT snapshot reading
This change removes the extra pass over global object pool after AOT
snapshot is loaded by adding extra kSwitchableCallMissEntryPoint and
kMegamorphicCallEntryPoint object pool entry kinds which are handled
during ReadFill phase.

On a low-end phone and large Flutter app compiled in release mode
with dwarf_stack_traces, FullSnapshotReader::ReadProgramSnapshot time
Before: 232.41 ms
After:  202.43 ms (-12.8%)

Also, this change adds PrintTimeScope utility class which can be used
to measure and print time in release mode without timeline and profiling
tools:

ApiErrorPtr FullSnapshotReader::ReadProgramSnapshot() {
  PrintTimeScope tm("FullSnapshotReader::ReadProgramSnapshot");
  ...
}

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/46116
Change-Id: I42bd46761eac8fc1e52ca695cacd2b86705034d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215500
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-10-05 16:32:40 +00:00

19 lines
527 B
C++

// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "vm/timer.h"
#include "platform/globals.h"
#include "vm/json_stream.h"
#include "vm/thread.h"
namespace dart {
PrintTimeScope::~PrintTimeScope() {
timer_.Stop();
OS::PrintErr("%s %s\n", name_,
timer_.FormatElapsedHumanReadable(Thread::Current()->zone()));
}
} // namespace dart