Commit 0d787761 authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

[wasm] Add a counter that compares liftoff with deserialization

- Adds a counter to measure time from creating the async compile job
  to either baseline compilation or deserialization completion, so we
  can evaluate the benefit from code caching.
- Eliminates the counter that measures deserialization.

Bug: chromium:719172
Change-Id: Iefa707ef73ac20377d5164a1bd5f1e462573ce06
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1888829Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64694}
parent 4b7f6029
......@@ -191,8 +191,8 @@ namespace internal {
V8.WasmCompileModuleAsyncMicroSeconds, 100000000, MICROSECOND) \
HT(wasm_streaming_compile_wasm_module_time, \
V8.WasmCompileModuleStreamingMicroSeconds, 100000000, MICROSECOND) \
HT(wasm_streaming_deserialize_wasm_module_time, \
V8.WasmDeserializeModuleStreamingMicroSeconds, 100000000, MICROSECOND) \
HT(wasm_streaming_finish_wasm_module_time, \
V8.WasmFinishModuleStreamingMicroSeconds, 100000000, MICROSECOND) \
HT(wasm_tier_up_module_time, V8.WasmTierUpModuleMicroSeconds, 100000000, \
MICROSECOND) \
HT(wasm_compile_asm_function_time, V8.WasmCompileFunctionMicroSeconds.asm, \
......
......@@ -1391,6 +1391,7 @@ AsyncCompileJob::AsyncCompileJob(
api_method_name_(api_method_name),
enabled_features_(enabled),
wasm_lazy_compilation_(FLAG_wasm_lazy_compilation),
start_time_(base::TimeTicks::Now()),
bytes_copy_(std::move(bytes_copy)),
wire_bytes_(bytes_copy_.get(), bytes_copy_.get() + length),
resolver_(std::move(resolver)) {
......@@ -1450,7 +1451,6 @@ class AsyncStreamingProcessor final : public StreamingProcessor {
AsyncCompileJob* job_;
WasmEngine* wasm_engine_;
std::unique_ptr<CompilationUnitBuilder> compilation_unit_builder_;
base::TimeTicks start_time_;
int num_functions_ = 0;
};
......@@ -1527,6 +1527,15 @@ void AsyncCompileJob::FinishCompile() {
if (!is_after_deserialization) {
PrepareRuntimeObjects();
}
// Measure duration of baseline compilation or deserialization from cache.
if (base::TimeTicks::IsHighResolution()) {
base::TimeDelta duration = base::TimeTicks::Now() - start_time_;
int duration_usecs = static_cast<int>(duration.InMicroseconds());
isolate_->counters()->wasm_streaming_finish_wasm_module_time()->AddSample(
duration_usecs);
}
DCHECK(!isolate_->context().is_null());
// Finish the wasm script now and make it public to the debugger.
Handle<Script> script(module_object_->script(), isolate_);
......@@ -1946,8 +1955,7 @@ AsyncStreamingProcessor::AsyncStreamingProcessor(AsyncCompileJob* job)
: decoder_(job->enabled_features_),
job_(job),
wasm_engine_(job_->isolate_->wasm_engine()),
compilation_unit_builder_(nullptr),
start_time_(base::TimeTicks::Now()) {}
compilation_unit_builder_(nullptr) {}
void AsyncStreamingProcessor::FinishAsyncCompileJobWithError(
const WasmError& error) {
......@@ -2176,12 +2184,6 @@ bool AsyncStreamingProcessor::Deserialize(Vector<const uint8_t> module_bytes,
MaybeHandle<WasmModuleObject> result =
DeserializeNativeModule(job_->isolate_, module_bytes, wire_bytes);
if (base::TimeTicks::IsHighResolution()) {
base::TimeDelta duration = base::TimeTicks::Now() - start_time_;
auto* histogram = job_->isolate_->counters()
->wasm_streaming_deserialize_wasm_module_time();
histogram->AddSample(static_cast<int>(duration.InMicroseconds()));
}
if (result.is_null()) return false;
......
......@@ -191,6 +191,7 @@ class AsyncCompileJob {
const char* const api_method_name_;
const WasmFeatures enabled_features_;
const bool wasm_lazy_compilation_;
base::TimeTicks start_time_;
// Copy of the module wire bytes, moved into the {native_module_} on its
// creation.
std::unique_ptr<byte[]> bytes_copy_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment