[shared storage] Add AbsoluteUsefulResourceDuration UMA
Why: This helps to see if there are long-running worklets, which can impact performance or be exploited for side-channel attacks. If the result reveals such instances, we will further add UKM to investigate the specific use cases. Given that the existing 'UsefulResourceDuration' represents a percentage, we add 'AbsoluteUsefulResourceDuration' for a distinction. Bug: 398173023 Change-Id: I8b69362158a35b0861033f8f58a0aa335edb4241 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6287655 Reviewed-by: Ayu Ishii <ayui@chromium.org> Commit-Queue: Yao Xiao <yaoxia@chromium.org> Cr-Commit-Position: refs/heads/main@{#1423455}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
06c21e83b3
commit
effa1d6cf0
content/browser/shared_storage
tools/metrics/histograms/metadata/storage
@ -489,6 +489,24 @@ SharedStorageWorkletHost::~SharedStorageWorkletHost() {
|
||||
elapsed_time_since_creation);
|
||||
}
|
||||
|
||||
// Initialize to zero. This represents the scenario where the worklet didn't
|
||||
// execute any operations due to early validation failure, ensuring
|
||||
// consistency with the scope of the `UsefulResourceDuration` metric.
|
||||
base::TimeDelta useful_resource_duration;
|
||||
if (pending_operations_count_ > 0) {
|
||||
// Worklet is still processing, so the useful duration is its total
|
||||
// lifetime.
|
||||
useful_resource_duration = elapsed_time_since_creation;
|
||||
} else if (!last_operation_finished_time_.is_null()) {
|
||||
// Worklet finished at least one operation. Useful duration is until the
|
||||
// last operation.
|
||||
useful_resource_duration = last_operation_finished_time_ - creation_time_;
|
||||
}
|
||||
|
||||
base::UmaHistogramTimes(
|
||||
"Storage.SharedStorage.Worklet.Timing.AbsoluteUsefulResourceDuration",
|
||||
useful_resource_duration);
|
||||
|
||||
if (!page_) {
|
||||
return;
|
||||
}
|
||||
|
@ -1973,6 +1973,20 @@ chromium-metrics-reviews@google.com.
|
||||
</summary>
|
||||
</histogram>
|
||||
|
||||
<histogram
|
||||
name="Storage.SharedStorage.Worklet.Timing.AbsoluteUsefulResourceDuration"
|
||||
units="ms" expires_after="2025-08-21">
|
||||
<owner>cammie@chromium.org</owner>
|
||||
<owner>yaoxia@chromium.org</owner>
|
||||
<owner>chrome-ads-histograms@google.com</owner>
|
||||
<summary>
|
||||
Measures the total duration that a Shared Storage worklet is actively
|
||||
processing operations (i.e, from the worklet's creation until either its
|
||||
last operation completes or it is destroyed). Recorded when the worklet is
|
||||
destroyed.
|
||||
</summary>
|
||||
</histogram>
|
||||
|
||||
<histogram name="Storage.SharedStorage.Worklet.Timing.Append" units="ms"
|
||||
expires_after="2025-08-10">
|
||||
<owner>cammie@chromium.org</owner>
|
||||
@ -2126,11 +2140,10 @@ chromium-metrics-reviews@google.com.
|
||||
<owner>yaoxia@chromium.org</owner>
|
||||
<owner>chrome-ads-histograms@google.com</owner>
|
||||
<summary>
|
||||
Measures the percentage of the time duration between a
|
||||
`SharedStorageWorkletHost`'s creation and destruction that occurs before the
|
||||
time of its last finished operation. For worklets that are destroyed before
|
||||
completing their outstanding operations, we record 100. Recorded in the
|
||||
destructor of `SharedStorageWorkletHost`.
|
||||
Measures the percentage of a shared storage worklet's lifetime that it is
|
||||
actively processing operations (i.e., from the worklet's creation until
|
||||
either its last operation completes or it is destroyed). If the worklet has
|
||||
zero lifetime, we record 100. Recorded when the worklet is destroyed.
|
||||
</summary>
|
||||
</histogram>
|
||||
|
||||
|
Reference in New Issue
Block a user