Skip to content

Commit

Permalink
[telemetry] Fix histogram range of SbPlayer Create/Destroy (#3822)
Browse files Browse the repository at this point in the history
Fix the upper bounds of the range for SbPlayerCreate/SbPlayerDestroy.

The rough range of each function:
1. SbPlayerCreate(): 1.23ms to 25.15ms
2. SbPlayerDestroy(): 70.9ms to 186.81ms

b/303328238
  • Loading branch information
borongc authored Jul 16, 2024
1 parent 8b94cf7 commit 13129a1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
18 changes: 8 additions & 10 deletions cobalt/media/base/metrics_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,19 @@ void MediaMetricsProvider::ReportActionLatencyUMA(
break;
case MediaAction::SBPLAYER_CREATE:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.Create.Timing", action_duration,
base::TimeDelta::FromMicroseconds(100),
base::TimeDelta::FromMicroseconds(1500), 50);
"Cobalt.Media.SbPlayer.Create.LatencyTiming", action_duration,
base::TimeDelta::FromMicroseconds(500),
base::TimeDelta::FromMilliseconds(50), 50);
break;
case MediaAction::SBPLAYER_CREATE_URL_PLAYER:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.CreateUrlPlayer.Timing", action_duration,
base::TimeDelta::FromMicroseconds(100),
base::TimeDelta::FromMicroseconds(1500), 50);
"Cobalt.Media.SbPlayer.CreateUrlPlayer.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(500),
base::TimeDelta::FromMilliseconds(50), 50);
break;
case MediaAction::SBPLAYER_DESTROY:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.Destroy.Timing", action_duration,
base::TimeDelta::FromMicroseconds(500),
base::TimeDelta::FromMicroseconds(40000), 50);
UMA_HISTOGRAM_TIMES("Cobalt.Media.SbPlayer.Destroy.LatencyTiming",
action_duration);
break;
case MediaAction::UNKNOWN_ACTION:
default:
Expand Down
9 changes: 5 additions & 4 deletions cobalt/media/base/metrics_provider_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ TEST_F(MediaMetricsProviderTest, SbPlayerCreate) {
metrics_.EndTrackingAction(MediaAction::SBPLAYER_CREATE);

histogram_tester_.ExpectUniqueSample(
std::string(kUmaPrefix) + "SbPlayer.Create.Timing", 570, 1);
std::string(kUmaPrefix) + "SbPlayer.Create.LatencyTiming", 570, 1);
}

TEST_F(MediaMetricsProviderTest, SbPlayerCreateUrlPlayer) {
Expand All @@ -80,17 +80,18 @@ TEST_F(MediaMetricsProviderTest, SbPlayerCreateUrlPlayer) {
metrics_.EndTrackingAction(MediaAction::SBPLAYER_CREATE_URL_PLAYER);

histogram_tester_.ExpectUniqueSample(
std::string(kUmaPrefix) + "SbPlayer.CreateUrlPlayer.Timing", 670, 1);
std::string(kUmaPrefix) + "SbPlayer.CreateUrlPlayer.LatencyTiming", 670,
1);
}

TEST_F(MediaMetricsProviderTest, SbPlayerDestroy) {
metrics_.StartTrackingAction(MediaAction::SBPLAYER_DESTROY);

clock_.Advance(base::TimeDelta::FromMicroseconds(1570));
clock_.Advance(base::TimeDelta::FromMilliseconds(100));
metrics_.EndTrackingAction(MediaAction::SBPLAYER_DESTROY);

histogram_tester_.ExpectUniqueSample(
std::string(kUmaPrefix) + "SbPlayer.Destroy.Timing", 1570, 1);
std::string(kUmaPrefix) + "SbPlayer.Destroy.LatencyTiming", 100, 1);
}


Expand Down
12 changes: 6 additions & 6 deletions tools/metrics/histograms/metadata/cobalt/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,16 @@ Always run the pretty print utility on this file after editing:
</summary>
</histogram>

<histogram name="Cobalt.Media.SbPlayer.Create.Timing" units="microseconds"
expires_after="never">
<histogram name="Cobalt.Media.SbPlayer.Create.LatencyTiming"
units="microseconds" expires_after="never">
<!-- expires-never: Needed for long-term tracking of SbPlayer latencies. -->

<owner>[email protected]</owner>
<owner>[email protected]</owner>
<summary>Timing data for the creation of SbPlayer.</summary>
</histogram>

<histogram name="Cobalt.Media.SbPlayer.CreateUrlPlayer.Timing"
<histogram name="Cobalt.Media.SbPlayer.CreateUrlPlayer.LatencyTiming"
units="microseconds" expires_after="never">
<!-- expires-never: Needed for long-term tracking of SbPlayer latencies. -->

Expand All @@ -293,7 +293,7 @@ Always run the pretty print utility on this file after editing:
<summary>Timing data for the creation of an SbPlayer::UrlPlayer.</summary>
</histogram>

<histogram name="Cobalt.Media.SbPlayer.Destroy.Timing" units="microseconds"
<histogram name="Cobalt.Media.SbPlayer.Destroy.LatencyTiming" units="ms"
expires_after="never">
<!-- expires-never: Needed for long-term tracking of SbPlayer latencies. -->

Expand Down Expand Up @@ -355,8 +355,8 @@ Always run the pretty print utility on this file after editing:
<owner>[email protected]</owner>
<owner>[email protected]</owner>
<summary>
A measure of the rate at which `SourceBuffer.appendBuffer` calls are able
to process data over time.
A measure of the rate at which `SourceBuffer.appendBuffer` calls are able to
process data over time.
</summary>
</histogram>

Expand Down

0 comments on commit 13129a1

Please sign in to comment.