Skip to content

Commit

Permalink
Use the ELF loader to setup AOT symbols in benchmark runner. (flutter…
Browse files Browse the repository at this point in the history
…#17051)

We no longer package AOT artifacts as discrete blobs. The portable ELF loader
from the testing library may be used instead.

Fixes flutter#52263
  • Loading branch information
chinmaygarde authored Mar 10, 2020
1 parent 498a34a commit bcefcdb
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 24 deletions.
5 changes: 1 addition & 4 deletions lib/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@ if (current_toolchain == host_toolchain) {
":ui",
":ui_unittests_fixtures",
"//flutter/common",
"//flutter/fml",
"//flutter/lib/snapshot",
"//flutter/runtime",
"//flutter/shell/common",
"//flutter/testing",
"//flutter/testing:dart",
"//flutter/testing:opengl",
"//flutter/third_party/tonic",
Expand Down
1 change: 1 addition & 0 deletions runtime/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ source_set("runtime_unittests_common") {
"//flutter/fml",
"//flutter/lib/snapshot",
"//flutter/shell/common",
"//flutter/testing",
"//flutter/testing:dart",
"//flutter/third_party/tonic",
"//third_party/dart/runtime/bin:elf_loader",
Expand Down
2 changes: 2 additions & 0 deletions shell/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ if (enable_unittests) {
"//flutter/fml/dart",
"//flutter/lib/ui:ui",
"//flutter/shell",
"//flutter/testing",
"//flutter/testing:dart",
]

Expand Down Expand Up @@ -278,6 +279,7 @@ if (enable_unittests) {
deps = [
":shell_unittests_fixtures",
"//flutter/benchmarking",
"//flutter/testing:dart",
"//flutter/testing:testing_lib",
]
}
Expand Down
26 changes: 7 additions & 19 deletions shell/common/shell_benchmarks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "flutter/runtime/dart_vm.h"
#include "flutter/shell/common/shell.h"
#include "flutter/shell/common/thread_host.h"
#include "flutter/testing/elf_loader.h"
#include "flutter/testing/testing.h"

namespace flutter {
Expand All @@ -18,32 +19,19 @@ static void StartupAndShutdownShell(benchmark::State& state,
fml::FilePermission::kRead);
std::unique_ptr<Shell> shell;
std::unique_ptr<ThreadHost> thread_host;
testing::ELFAOTSymbols aot_symbols;

{
benchmarking::ScopedPauseTiming pause(state, !measure_startup);
Settings settings = {};
settings.task_observer_add = [](intptr_t, fml::closure) {};
settings.task_observer_remove = [](intptr_t) {};

if (DartVM::IsRunningPrecompiledCode()) {
settings.vm_snapshot_data = [&]() {
return fml::FileMapping::CreateReadOnly(assets_dir, "vm_snapshot_data");
};

settings.isolate_snapshot_data = [&]() {
return fml::FileMapping::CreateReadOnly(assets_dir,
"isolate_snapshot_data");
};

settings.vm_snapshot_instr = [&]() {
return fml::FileMapping::CreateReadExecute(assets_dir,
"vm_snapshot_instr");
};

settings.isolate_snapshot_instr = [&]() {
return fml::FileMapping::CreateReadExecute(assets_dir,
"isolate_snapshot_instr");
};

aot_symbols = testing::LoadELFSymbolFromFixturesIfNeccessary();
FML_CHECK(
testing::PrepareSettingsForAOTWithSymbols(settings, aot_symbols))
<< "Could not setup settings with AOT symbols.";
} else {
settings.application_kernels = [&]() {
std::vector<std::unique_ptr<const fml::Mapping>> kernel_mappings;
Expand Down
1 change: 1 addition & 0 deletions shell/platform/embedder/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ if (current_toolchain == host_toolchain) {
"//flutter/flow",
"//flutter/lib/ui",
"//flutter/runtime",
"//flutter/testing",
"//flutter/testing:dart",
"//flutter/testing:opengl",
"//flutter/testing:skia",
Expand Down
2 changes: 1 addition & 1 deletion testing/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ source_set("dart") {
]

public_deps = [
":testing",
":testing_lib",
"//flutter/common",
"//flutter/runtime",
"//flutter/runtime:libdart",
Expand Down

0 comments on commit bcefcdb

Please sign in to comment.