Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Unified Diff: third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp

Issue 1978403004: Add UMA histograms for WebAudio (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use CustomCountHistogram Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
index dc3afb966c3be24c02b0a5c034ddb0727f8a75d7..1bf36e7fd458713ce98bf49595ea948953ace9e1 100644
--- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
@@ -35,6 +35,7 @@
#include "modules/webaudio/OfflineAudioCompletionEvent.h"
#include "modules/webaudio/OfflineAudioDestinationNode.h"
+#include "platform/Histogram.h"
#include "platform/audio/AudioUtilities.h"
namespace blink {
@@ -90,6 +91,24 @@ OfflineAudioContext* OfflineAudioContext::create(ExecutionContext* context, unsi
+ ")");
}
+ DEFINE_STATIC_LOCAL(SparseHistogram, offlineContextChannelCountHistogram,
+ ("WebAudio.OfflineAudioContext.ChannelCount"));
+ // Arbitrarly limit the maximum length to 1 million frames (about 20 sec
+ // at 48kHz). The number of buckets is fairly arbitrary.
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, offlineContextLengthHistogram,
+ ("WebAudio.OfflineAudioContext.Length", 1, 1000000, 50));
+ // The limits are the min and max AudioBuffer sample rates currently
+ // supported. We use explicit values here instead of
+ // AudioUtilities::minAudioBufferSampleRate() and
+ // AudioUtilities::maxAudioBufferSampleRate(). The number of buckets is
+ // fairly arbitrary.
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, offlineContextSampleRateHistogram,
+ ("WebAudio.OfflineAudioContext.SampleRate", 3000, 19200, 50));
+
+ offlineContextChannelCountHistogram.sample(numberOfChannels);
+ offlineContextLengthHistogram.count(numberOfFrames);
+ offlineContextSampleRateHistogram.count(sampleRate);
+
audioContext->suspendIfNeeded();
return audioContext;
}

Powered by Google App Engine
This is Rietveld 408576698