Commit 620afd23 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm][eh] Add metrics for total EH event counts

R=ahaas@chromium.org

Bug: v8:8091
Change-Id: I3d1053b3a11bf81ed2e58098f8429683d4e753ed
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2690597Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72740}
parent 4f7aff2d
......@@ -85,6 +85,12 @@ namespace internal {
HR(wasm_modules_per_engine, V8.WasmModulesPerEngine, 1, 1024, 30) \
/* bailout reason if Liftoff failed, or {kSuccess} (per function) */ \
HR(liftoff_bailout_reasons, V8.LiftoffBailoutReasons, 0, 20, 21) \
/* number of thrown exceptions per isolate */ \
HR(wasm_throw_count, V8.WasmThrowCount, 0, 100000, 30) \
/* number of rethrown exceptions per isolate */ \
HR(wasm_rethrow_count, V8.WasmReThrowCount, 0, 100000, 30) \
/* number of caught exceptions per isolate */ \
HR(wasm_catch_count, V8.WasmCatchCount, 0, 100000, 30) \
/* Ticks observed in a single Turbofan compilation, in 1K */ \
HR(turbofan_ticks, V8.TurboFan1KTicks, 0, 100000, 200) \
/* Backtracks observed in a single regexp interpreter execution */ \
......
......@@ -394,6 +394,11 @@ struct WasmEngine::IsolateInfo {
base::ElapsedTimer throw_timer;
base::ElapsedTimer rethrow_timer;
base::ElapsedTimer catch_timer;
// Total number of exception events in this isolate.
int throw_count = 0;
int rethrow_count = 0;
int catch_count = 0;
};
struct WasmEngine::NativeModuleInfo {
......@@ -1007,6 +1012,9 @@ void WasmEngine::RemoveIsolate(Isolate* isolate) {
for (auto& log_entry : info->code_to_log) {
WasmCode::DecrementRefCount(VectorOf(log_entry.second.code));
}
isolate->counters()->wasm_throw_count()->AddSample(info->throw_count);
isolate->counters()->wasm_rethrow_count()->AddSample(info->rethrow_count);
isolate->counters()->wasm_catch_count()->AddSample(info->catch_count);
}
void WasmEngine::LogCode(Vector<WasmCode*> code_vec) {
......@@ -1389,18 +1397,30 @@ void SampleExceptionEvent(base::ElapsedTimer* timer, TimedHistogram* counter) {
void WasmEngine::SampleThrowEvent(Isolate* isolate) {
base::MutexGuard guard(&mutex_);
int& throw_count = isolates_[isolate]->throw_count;
// To avoid an int overflow, clip the count to the histogram's max value.
throw_count =
std::min(throw_count + 1, isolate->counters()->wasm_throw_count()->max());
SampleExceptionEvent(&isolates_[isolate]->throw_timer,
isolate->counters()->wasm_time_between_throws());
}
void WasmEngine::SampleRethrowEvent(Isolate* isolate) {
base::MutexGuard guard(&mutex_);
int& rethrow_count = isolates_[isolate]->rethrow_count;
// To avoid an int overflow, clip the count to the histogram's max value.
rethrow_count = std::min(rethrow_count + 1,
isolate->counters()->wasm_rethrow_count()->max());
SampleExceptionEvent(&isolates_[isolate]->rethrow_timer,
isolate->counters()->wasm_time_between_rethrows());
}
void WasmEngine::SampleCatchEvent(Isolate* isolate) {
base::MutexGuard guard(&mutex_);
int& catch_count = isolates_[isolate]->catch_count;
// To avoid an int overflow, clip the count to the histogram's max value.
catch_count =
std::min(catch_count + 1, isolate->counters()->wasm_catch_count()->max());
SampleExceptionEvent(&isolates_[isolate]->catch_timer,
isolate->counters()->wasm_time_between_catch());
}
......
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