Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[telemetry] Add telemetry to SbMedia functions" #4264

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions cobalt/media/base/metrics_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,49 +238,6 @@ void MediaMetricsProvider::ReportActionLatencyUMA(
base::TimeDelta::FromMicroseconds(500),
base::TimeDelta::FromMilliseconds(50), 50);
break;
case MediaAction::SBMEDIA_BUFFER_POOL_ALLOCATE_ON_DEMAND:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbMedia.BufferPoolAllocateOnDemand.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(5), 50);
break;
case MediaAction::SBMEDIA_GET_INIT_BUFFER_CAPACITY:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbMedia.GetInitBufferCapacity.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(5), 50);
break;
case MediaAction::SBMEDIA_GET_BUFFER_ALLOCATION_UNIT:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbMedia.GetBufferAllocationUnit.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(5), 50);
break;
case MediaAction::SBMEDIA_GET_AUDIO_BUFFER_BUDGET:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbMedia.GetAudioBufferBudget.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(20), 50);
break;
case MediaAction::SBMEDIA_GET_BUFFER_GARBAGE_COLLECTION_DURATION_THRESHOLD:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbMedia.GetBufferGarbageCollectionDurationThreshold."
"LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(20), 50);
break;
case MediaAction::SBMEDIA_GET_PROGRESSIVE_BUFFER_BUDGET:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbMedia.GetProgressiveBufferBudget.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(20), 50);
break;
case MediaAction::SBMEDIA_GET_VIDEO_BUFFER_BUDGET:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbMedia.GetVideoBufferBudget.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(20), 50);
break;
case MediaAction::UNKNOWN_ACTION:
default:
break;
Expand Down
7 changes: 0 additions & 7 deletions cobalt/media/base/metrics_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ enum class MediaAction : uint8_t {
SBDRM_GENERATE_SESSION_UPDATE_REQUEST,
SBDRM_UPDATE_SESSION,
SBDRM_CLOSE_SESSION,
SBMEDIA_BUFFER_POOL_ALLOCATE_ON_DEMAND,
SBMEDIA_GET_INIT_BUFFER_CAPACITY,
SBMEDIA_GET_BUFFER_ALLOCATION_UNIT,
SBMEDIA_GET_AUDIO_BUFFER_BUDGET,
SBMEDIA_GET_BUFFER_GARBAGE_COLLECTION_DURATION_THRESHOLD,
SBMEDIA_GET_PROGRESSIVE_BUFFER_BUDGET,
SBMEDIA_GET_VIDEO_BUFFER_BUDGET,
};

class MediaMetricsProvider {
Expand Down
86 changes: 0 additions & 86 deletions cobalt/media/base/metrics_provider_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,92 +254,6 @@ TEST_F(MediaMetricsProviderTest, SbDrmUpdateSession) {
std::string(kUmaPrefix) + "SbDrm.UpdateSession.LatencyTiming", 100, 1);
}

TEST_F(MediaMetricsProviderTest, SbMediaIsBufferPoolAllocateOnDemand) {
metrics_.StartTrackingAction(
MediaAction::SBMEDIA_BUFFER_POOL_ALLOCATE_ON_DEMAND);

clock_.Advance(base::TimeDelta::FromMicroseconds(570));
metrics_.EndTrackingAction(
MediaAction::SBMEDIA_BUFFER_POOL_ALLOCATE_ON_DEMAND);

histogram_tester_.ExpectUniqueSample(
std::string(kUmaPrefix) +
"SbMedia.BufferPoolAllocateOnDemand.LatencyTiming",
570, 1);
}

TEST_F(MediaMetricsProviderTest, SbMediaGetInitialBufferCapacity) {
metrics_.StartTrackingAction(MediaAction::SBMEDIA_GET_INIT_BUFFER_CAPACITY);

clock_.Advance(base::TimeDelta::FromMicroseconds(570));
metrics_.EndTrackingAction(MediaAction::SBMEDIA_GET_INIT_BUFFER_CAPACITY);

histogram_tester_.ExpectUniqueSample(
std::string(kUmaPrefix) + "SbMedia.GetInitBufferCapacity.LatencyTiming",
570, 1);
}

TEST_F(MediaMetricsProviderTest, SbMediaGetBufferAllocationUnit) {
metrics_.StartTrackingAction(MediaAction::SBMEDIA_GET_BUFFER_ALLOCATION_UNIT);

clock_.Advance(base::TimeDelta::FromMicroseconds(570));
metrics_.EndTrackingAction(MediaAction::SBMEDIA_GET_BUFFER_ALLOCATION_UNIT);

histogram_tester_.ExpectUniqueSample(
std::string(kUmaPrefix) + "SbMedia.GetBufferAllocationUnit.LatencyTiming",
570, 1);
}

TEST_F(MediaMetricsProviderTest, SbMediaGetAudioBufferBudget) {
metrics_.StartTrackingAction(MediaAction::SBMEDIA_GET_AUDIO_BUFFER_BUDGET);

clock_.Advance(base::TimeDelta::FromMicroseconds(570));
metrics_.EndTrackingAction(MediaAction::SBMEDIA_GET_AUDIO_BUFFER_BUDGET);

histogram_tester_.ExpectUniqueSample(
std::string(kUmaPrefix) + "SbMedia.GetAudioBufferBudget.LatencyTiming",
570, 1);
}

TEST_F(MediaMetricsProviderTest,
SbMediaGetBufferGarbageCollectionDurationThreshold) {
metrics_.StartTrackingAction(
MediaAction::SBMEDIA_GET_BUFFER_GARBAGE_COLLECTION_DURATION_THRESHOLD);

clock_.Advance(base::TimeDelta::FromMicroseconds(570));
metrics_.EndTrackingAction(
MediaAction::SBMEDIA_GET_BUFFER_GARBAGE_COLLECTION_DURATION_THRESHOLD);

histogram_tester_.ExpectUniqueSample(
std::string(kUmaPrefix) +
"SbMedia.GetBufferGarbageCollectionDurationThreshold.LatencyTiming",
570, 1);
}

TEST_F(MediaMetricsProviderTest, SbMediaGetProgressiveBufferBudget) {
metrics_.StartTrackingAction(
MediaAction::SBMEDIA_GET_PROGRESSIVE_BUFFER_BUDGET);

clock_.Advance(base::TimeDelta::FromMicroseconds(570));
metrics_.EndTrackingAction(
MediaAction::SBMEDIA_GET_PROGRESSIVE_BUFFER_BUDGET);

histogram_tester_.ExpectUniqueSample(
std::string(kUmaPrefix) +
"SbMedia.GetProgressiveBufferBudget.LatencyTiming",
570, 1);
}

TEST_F(MediaMetricsProviderTest, SbMediaGetVideoBufferBudget) {
metrics_.StartTrackingAction(MediaAction::SBMEDIA_GET_VIDEO_BUFFER_BUDGET);

clock_.Advance(base::TimeDelta::FromMicroseconds(570));
metrics_.EndTrackingAction(MediaAction::SBMEDIA_GET_VIDEO_BUFFER_BUDGET);

histogram_tester_.ExpectUniqueSample(
std::string(kUmaPrefix) + "SbMedia.GetVideoBufferBudget.LatencyTiming",
570, 1);
}

} // namespace
} // namespace media
Expand Down
73 changes: 9 additions & 64 deletions cobalt/media/decoder_buffer_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,45 +38,11 @@ const size_t kSmallAllocationThreshold = 512;

} // namespace

bool CreateSbMediaIsBufferPoolAllocateOnDemandWithHistogram(
MediaMetricsProvider& media_metrics_provider) {
media_metrics_provider.StartTrackingAction(
MediaAction::SBMEDIA_BUFFER_POOL_ALLOCATE_ON_DEMAND);
auto is_memory_pool_allocated_on_demand =
SbMediaIsBufferPoolAllocateOnDemand();
media_metrics_provider.EndTrackingAction(
MediaAction::SBMEDIA_BUFFER_POOL_ALLOCATE_ON_DEMAND);
return is_memory_pool_allocated_on_demand;
}

int CreateSbMediaGetInitialBufferCapacityWithHistogram(
MediaMetricsProvider& media_metrics_provider) {
media_metrics_provider.StartTrackingAction(
MediaAction::SBMEDIA_GET_INIT_BUFFER_CAPACITY);
auto initial_capacity = SbMediaGetInitialBufferCapacity();
media_metrics_provider.EndTrackingAction(
MediaAction::SBMEDIA_GET_INIT_BUFFER_CAPACITY);
return initial_capacity;
}

bool CreateSbMediaGetBufferAllocationUnitWithHistogram(
MediaMetricsProvider& media_metrics_provider) {
media_metrics_provider.StartTrackingAction(
MediaAction::SBMEDIA_GET_BUFFER_ALLOCATION_UNIT);
auto allocation_unit = SbMediaGetBufferAllocationUnit();
media_metrics_provider.EndTrackingAction(
MediaAction::SBMEDIA_GET_BUFFER_ALLOCATION_UNIT);
return allocation_unit;
}

DecoderBufferAllocator::DecoderBufferAllocator()
: is_memory_pool_allocated_on_demand_(
CreateSbMediaIsBufferPoolAllocateOnDemandWithHistogram(
media_metrics_provider_)),
initial_capacity_(CreateSbMediaGetInitialBufferCapacityWithHistogram(
media_metrics_provider_)),
allocation_unit_(CreateSbMediaGetBufferAllocationUnitWithHistogram(
media_metrics_provider_)) {
SbMediaIsBufferPoolAllocateOnDemand()),
initial_capacity_(SbMediaGetInitialBufferCapacity()),
allocation_unit_(SbMediaGetBufferAllocationUnit()) {
if (is_memory_pool_allocated_on_demand_) {
DLOG(INFO) << "Allocated media buffer pool on demand.";
Allocator::Set(this);
Expand Down Expand Up @@ -158,12 +124,7 @@ void DecoderBufferAllocator::Free(void* p, size_t size) {
}

int DecoderBufferAllocator::GetAudioBufferBudget() const {
media_metrics_provider_.StartTrackingAction(
MediaAction::SBMEDIA_GET_AUDIO_BUFFER_BUDGET);
int audio_buffer_budget = SbMediaGetAudioBufferBudget();
media_metrics_provider_.EndTrackingAction(
MediaAction::SBMEDIA_GET_AUDIO_BUFFER_BUDGET);
return audio_buffer_budget;
return SbMediaGetAudioBufferBudget();
}

int DecoderBufferAllocator::GetBufferAlignment() const {
Expand All @@ -180,39 +141,23 @@ int DecoderBufferAllocator::GetBufferPadding() const {

base::TimeDelta
DecoderBufferAllocator::GetBufferGarbageCollectionDurationThreshold() const {
media_metrics_provider_.StartTrackingAction(
MediaAction::SBMEDIA_GET_BUFFER_GARBAGE_COLLECTION_DURATION_THRESHOLD);
int64_t buffer_garbage_collection_duration_threshold =
SbMediaGetBufferGarbageCollectionDurationThreshold();
media_metrics_provider_.EndTrackingAction(
MediaAction::SBMEDIA_GET_BUFFER_GARBAGE_COLLECTION_DURATION_THRESHOLD);
return base::TimeDelta::FromMicroseconds(
buffer_garbage_collection_duration_threshold);
SbMediaGetBufferGarbageCollectionDurationThreshold());
}

int DecoderBufferAllocator::GetProgressiveBufferBudget(
SbMediaVideoCodec codec, int resolution_width, int resolution_height,
int bits_per_pixel) const {
media_metrics_provider_.StartTrackingAction(
MediaAction::SBMEDIA_GET_PROGRESSIVE_BUFFER_BUDGET);
int progressive_buffer_budget = SbMediaGetProgressiveBufferBudget(
codec, resolution_width, resolution_height, bits_per_pixel);
media_metrics_provider_.EndTrackingAction(
MediaAction::SBMEDIA_GET_PROGRESSIVE_BUFFER_BUDGET);
return progressive_buffer_budget;
return SbMediaGetProgressiveBufferBudget(codec, resolution_width,
resolution_height, bits_per_pixel);
}

int DecoderBufferAllocator::GetVideoBufferBudget(SbMediaVideoCodec codec,
int resolution_width,
int resolution_height,
int bits_per_pixel) const {
media_metrics_provider_.StartTrackingAction(
MediaAction::SBMEDIA_GET_VIDEO_BUFFER_BUDGET);
int video_buffer_budget = SbMediaGetVideoBufferBudget(
codec, resolution_width, resolution_height, bits_per_pixel);
media_metrics_provider_.EndTrackingAction(
MediaAction::SBMEDIA_GET_VIDEO_BUFFER_BUDGET);
return video_buffer_budget;
return SbMediaGetVideoBufferBudget(codec, resolution_width, resolution_height,
bits_per_pixel);
}

size_t DecoderBufferAllocator::GetAllocatedMemory() const {
Expand Down
3 changes: 0 additions & 3 deletions cobalt/media/decoder_buffer_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "base/compiler_specific.h"
#include "base/synchronization/lock.h"
#include "base/time/time.h"
#include "cobalt/media/base/metrics_provider.h"
#include "cobalt/media/bidirectional_fit_reuse_allocator.h"
#include "cobalt/media/decoder_buffer_memory_info.h"
#include "cobalt/media/starboard_memory_allocator.h"
Expand Down Expand Up @@ -64,8 +63,6 @@ class DecoderBufferAllocator : public ::media::DecoderBuffer::Allocator,
private:
void EnsureReuseAllocatorIsCreated();

mutable MediaMetricsProvider media_metrics_provider_;

const bool is_memory_pool_allocated_on_demand_;
const int initial_capacity_;
const int allocation_unit_;
Expand Down
66 changes: 0 additions & 66 deletions tools/metrics/histograms/metadata/cobalt/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -320,72 +320,6 @@ Always run the pretty print utility on this file after editing:
<summary>Timing data for updating session of SbDrm.</summary>
</histogram>

<histogram name="Cobalt.Media.SbMedia.BufferPoolAllocateOnDemand.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 allocating buffer pool on demand.</summary>
</histogram>

<histogram name="Cobalt.Media.SbMedia.GetAudioBufferBudget.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 getting audio buffer budget.</summary>
</histogram>

<histogram name="Cobalt.Media.SbMedia.GetBufferAllocationUnit.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 getting buffer allocation unit.</summary>
</histogram>

<histogram
name="Cobalt.Media.SbMedia.GetBufferGarbageCollectionDurationThreshold.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 getting buffer garbage collection duration threshold.
</summary>
</histogram>

<histogram name="Cobalt.Media.SbMedia.GetInitBufferCapacity.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 getting initial buffer capacity.</summary>
</histogram>

<histogram name="Cobalt.Media.SbMedia.GetProgressiveBufferBudget.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 getting progressive buffer budget.</summary>
</histogram>

<histogram name="Cobalt.Media.SbMedia.GetVideoBufferBudget.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 getting video buffer budget.</summary>
</histogram>

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