Commit b5ede6fb authored by Raymond Toy's avatar Raymond Toy Committed by Chromium LUCI CQ

Add metrics for AudioContextOptions.latencyHint

Add metrics to record the value of latencyHint which can be one of
four values in the following order:

  "interactive"
  "balanced"
  "playback"
  exact

The first three are the values of the AudioContextLatencyCatergory
enum.  The last is for case when an explicit floating-point value
is given.

When the hint is a floating-point value, we record the value in
milliseconds.

Each of these metrics are recorded each time an AudioContext is
created.

Bug: 1156304
Change-Id: I264f6f9a38983bd0e40f42e720cfcf685e7a1cdc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586047Reviewed-by: default avatarJesse Doherty <jwd@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarHongchan Choi <hongchan@chromium.org>
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836777}
parent 786acb8d
......@@ -48,6 +48,8 @@ blink::WebAudioDeviceSourceType GetLatencyHintSourceType(
return blink::WebAudioDeviceSourceType::kWebAudioPlayback;
case WebAudioLatencyHint::kCategoryExact:
return blink::WebAudioDeviceSourceType::kWebAudioExact;
case WebAudioLatencyHint::kLastValue:
NOTREACHED();
}
NOTREACHED();
return blink::WebAudioDeviceSourceType::kWebAudioInteractive;
......
......@@ -17,7 +17,8 @@ class WebAudioLatencyHint {
kCategoryInteractive,
kCategoryBalanced,
kCategoryPlayback,
kCategoryExact
kCategoryExact,
kLastValue
};
explicit WebAudioLatencyHint(const WebString& category) {
......
......@@ -74,8 +74,16 @@ AudioContext* AudioContext::Create(Document& document,
// into account double buffering (same as baseLatency).
latency_hint =
WebAudioLatencyHint(context_options->latencyHint().GetAsDouble());
base::UmaHistogramTimes(
"WebAudio.AudioContext.latencyHintMilliSeconds",
base::TimeDelta::FromSecondsD(latency_hint.Seconds()));
}
base::UmaHistogramEnumeration(
"WebAudio.AudioContext.latencyHintCategory", latency_hint.Category(),
WebAudioLatencyHint::AudioContextLatencyCategory::kLastValue);
base::Optional<float> sample_rate;
if (context_options->hasSampleRate()) {
sample_rate = context_options->sampleRate();
......
......@@ -72,6 +72,30 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary>
</histogram>
<histogram name="WebAudio.AudioContext.latencyHintCategory" units="units"
expires_after="2021-06-30">
<owner>rtoy@chromium.org</owner>
<owner>hongchan@chromium.org</owner>
<summary>
If provided, the latencyHint option category of &quot;interactive&quot;,
&quot;balanced&quot;, &quot;playback&quot;, or &quot;exact&quot;, in that
order where &quot;exact&quot; means an explicit floating point value was
provided. Recorded for every AudioContext that is constructed with a
latencyHint.
</summary>
</histogram>
<histogram name="WebAudio.AudioContext.latencyHintMilliSeconds" units="ms"
expires_after="2021-06-30">
<owner>rtoy@chromium.org</owner>
<owner>hongchan@chromium.org</owner>
<summary>
If the latencyHint is provided and is a floating-point number, the value in
milliseconds is recorded. This is recorded for every AudioContext that is
constructed with a floating-point latencyHint value.
</summary>
</histogram>
<histogram name="WebAudio.AudioContext.MaxChannelsAvailable" units="units"
expires_after="2021-07-06">
<owner>rtoy@chromium.org</owner>
......
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