suspend inactive AudioNodeStreams

RESOLVED FIXED in Firefox OS v2.5

Status

()

Core
Web Audio
P1
normal
Rank:
5
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: karlt, Assigned: karlt)

Tracking

(Blocks: 1 bug)

Trunk
mozilla45
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(firefox44 affected, b2g-v2.5 fixed)

Details

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(6 attachments)

(Assignee)

Description

3 years ago
On http://webaudiodemos.appspot.com/MIDIDrums/index.html
increasing Tempo to 180 BPM and clicking play, while there are
only 1000 nodes perf top -t <msg-thread> indicates that biggest cpu consumers
are for convolution and resampling:

    10.13%  liblgpllibs.so  [.] rdft_calc_c                            
     7.26%  libxul.so       [.] moz_speex_interpolate_product_single   
     7.06%  libxul.so       [.] resampler_basic_interpolate_single     
     4.85%  libxul.so       [.] cubic_coef                             
     4.85%  libxul.so       [.] WebCore::DirectConvolver::process      
     4.82%  liblgpllibs.so  [.] ff_fft_permute_sse.loop                
     4.67%  libxul.so       [.] mozilla::AudioBufferAddWithScale       
     3.95%  libxul.so       [.] mozilla::DelayBuffer::ReadChannels     
     3.95%  libxul.so       [.] mozilla::BufferComplexMultiply         
     3.71%  liblgpllibs.so  [.] pass_sse.loop                          
     3.67%  libxul.so       [.] WebCore::FFTConvolver::process         
     3.62%  libxul.so       [.] mozilla::FFTBlock::GetInverseWithoutSca
     2.78%  liblgpllibs.so  [.] fft16_sse                              
     1.99%  libxul.so       [.] mozilla::FFTBlock::PerformFFT          
     1.92%  liblgpllibs.so  [.] pass_interleave_sse.loop               
     1.83%  libm-2.20.so    [.] __powf_finite                          
     1.25%  libxul.so       [.] mozilla::AudioNodeStream::ObtainInputBl
     1.11%  liblgpllibs.so  [.] fft8_sse                               
     1.09%  libxul.so       [.] mozilla::AudioNodeStream::ProcessInput 
     1.08%  libm-2.20.so    [.] __logf_finite                          
     1.07%  libxul.so       [.] WebCore::ReverbConvolverStage::process 
     0.99%  libxul.so       [.] WebCore::ZeroPole::process             
     0.88%  libxul.so       [.] WebCore::DynamicsCompressorKernel::proc
     0.81%  libxul.so       [.] moz_speex_resampler_set_rate_frac      
     0.80%  libxul.so       [.] moz_speex_resampler_process_float      

When the number of nodes reaches 15000, looping over inactive nodes makes up
big parts of cpu time.

    11.31%  libxul.so       [.] mozilla::AudioNodeStream::ProcessInput 
     9.23%  libxul.so       [.] mozilla::AudioNodeStream::ObtainInputBl
     7.71%  libxul.so       [.] mozilla::MediaStreamGraphImpl::UpdateSt
     5.04%  libxul.so       [.] mozilla::MediaStreamGraphImpl::ProduceD
     4.69%  liblgpllibs.so  [.] rdft_calc_c                            
     3.31%  libxul.so       [.] moz_speex_interpolate_product_single   
     3.21%  libxul.so       [.] resampler_basic_interpolate_single     
     3.05%  libxul.so       [.] mozilla::MediaStreamGraphImpl::NotifyHa
     2.91%  libxul.so       [.] mozilla::MediaStreamGraphImpl::CreateOr
     2.52%  liblgpllibs.so  [.] ff_fft_permute_sse.loop                
     2.36%  libxul.so       [.] mozilla::AudioBufferAddWithScale       
     2.27%  libxul.so       [.] WebCore::DirectConvolver::process      
     2.20%  libxul.so       [.] cubic_coef                             
     2.13%  libxul.so       [.] WebCore::FFTConvolver::process         
     1.94%  libxul.so       [.] mozilla::MediaStreamGraphImpl::UpdateCu
     1.87%  libxul.so       [.] mozilla::BufferComplexMultiply         
     1.80%  libxul.so       [.] mozilla::DelayBuffer::ReadChannels     
     1.77%  libxul.so       [.] mozilla::FFTBlock::GetInverseWithoutSca
     1.75%  liblgpllibs.so  [.] pass_sse.loop                          
     1.66%  libxul.so       [.] mozilla::AudioNodeStream::MainThreadNee
     1.60%  libxul.so       [.] mozilla::ProcessedMediaStream::AsProces
     1.59%  libxul.so       [.] mozilla::StreamBuffer::ForgetUpTo      
     1.51%  libxul.so       [.] mozilla::MediaStreamGraphImpl::StreamSe
     1.24%  liblgpllibs.so  [.] fft16_sse                              
     1.09%  libxul.so       [.] mozilla::FFTBlock::PerformFFT          

CPU usage of the MSG thread:
49% at 500 nodes.
57% at 6000 nodes.
67% at 10000 nodes.
80% at 15000 nodes.
90% at 19000 nodes.
(GC sweeps.)

By suspending inactive AudioNodeStreams, 65% of the CPU time spent on inactive
nodes is removed:
49% at 500 nodes.
52% at 6000 nodes.
55% at 10000 nodes.
60% at 15000 nodes.
65% at 20000 nodes.

The distribution at 15000 nodes becomes:

    15.14%  libxul.so       [.] mozilla::AudioNodeStream::ObtainInputBl
     6.80%  liblgpllibs.so  [.] rdft_calc_c                            
     6.65%  libxul.so       [.] mozilla::MediaStreamGraphImpl::UpdateCu
     4.84%  libxul.so       [.] moz_speex_interpolate_product_single   
     4.35%  libxul.so       [.] resampler_basic_interpolate_single     
     3.33%  libxul.so       [.] mozilla::AudioBufferAddWithScale       
     3.33%  liblgpllibs.so  [.] ff_fft_permute_sse.loop                
     3.11%  libxul.so       [.] cubic_coef                             
     2.99%  libxul.so       [.] WebCore::FFTConvolver::process         
     2.82%  libxul.so       [.] WebCore::DirectConvolver::process      
     2.62%  liblgpllibs.so  [.] pass_sse.loop                          
     2.57%  libxul.so       [.] mozilla::AudioNodeStream::MainThreadNee
     2.54%  libxul.so       [.] mozilla::MediaStreamGraphImpl::StreamSe
     2.48%  libxul.so       [.] mozilla::DelayBuffer::ReadChannels     
     2.48%  libxul.so       [.] mozilla::FFTBlock::GetInverseWithoutSca
     2.39%  libxul.so       [.] mozilla::BufferComplexMultiply         
     2.24%  libxul.so       [.] mozilla::MediaStreamGraphImpl::UpdateSt
     2.17%  libxul.so       [.] mozilla::StreamBuffer::ForgetUpTo      
     2.04%  libxul.so       [.] mozilla::MediaStreamGraphImpl::PrepareU
     1.60%  liblgpllibs.so  [.] fft16_sse                              
     1.46%  libxul.so       [.] mozilla::FFTBlock::PerformFFT          
     1.27%  liblgpllibs.so  [.] pass_interleave_sse.loop               
     1.24%  libm-2.20.so    [.] __powf_finite                          
     0.94%  libxul.so       [.] WebCore::ReverbConvolverStage::process 
     0.82%  libxul.so       [.] mozilla::MediaStreamGraphImpl::UpdateGr
(Assignee)

Comment 1

3 years ago
Created attachment 8677821 [details]
MozReview Request: bug 1217625 remove declarations of undefined methods r?padenot

bug 1217625 remove declarations of undefined methods r?padenot
Attachment #8677821 - Flags: review?(padenot)
(Assignee)

Comment 2

3 years ago
Created attachment 8677822 [details]
MozReview Request: bug 1217625 remove unused MessageQueue() and document message queue thread access r?padenot

bug 1217625 remove unused MessageQueue() and document message queue thread access r?padenot
Attachment #8677822 - Flags: review?(padenot)
(Assignee)

Comment 3

3 years ago
Created attachment 8677823 [details]
MozReview Request: bug 1217625 add a means to schedule a callback after processing on the graph thread r?padenot

bug 1217625 add a means to schedule a callback after processing on the graph thread r?padenot
Attachment #8677823 - Flags: review?(padenot)
(Assignee)

Comment 4

3 years ago
Created attachment 8677824 [details]
MozReview Request: bug 1217625 perform checks for transition to inactive outside of stream processing r?padenot

bug 1217625 perform checks for transition to inactive outside of stream processing r?padenot

This will allow streams to be suspended when they are discovered inactive.
Suspending is not possible while iterating over stream lists for processing.

The approach of delaying the transition to inactive state may result in a
couple of extra processing iterations, but can save on the number of messages
that need to be created when compared to the approach of traversing downstream
nodes during stream processing.
Attachment #8677824 - Flags: review?(padenot)
(Assignee)

Comment 5

3 years ago
Created attachment 8677825 [details]
MozReview Request: bug 1217625 remove ADD_STREAM_SUSPENDED r?padenot

bug 1217625 remove ADD_STREAM_SUSPENDED r?padenot

Sometimes we'll need an initial suspended count of 2, which is not supported
by this API, but this is not necessary anyway.
Attachment #8677825 - Flags: review?(padenot)
(Assignee)

Comment 6

3 years ago
Created attachment 8677826 [details]
MozReview Request: bug 1217625 suspend inactive AudioNodeStreams r?padenot

bug 1217625 suspend inactive AudioNodeStreams r?padenot
Attachment #8677826 - Flags: review?(padenot)
(Assignee)

Updated

3 years ago
Blocks: 930257
(Assignee)

Comment 8

3 years ago
Paul, I suspect you already have plenty to do with TPAC approaching, so feel free to delay these reviews till things settle down, if you like.
Comment on attachment 8677821 [details]
MozReview Request: bug 1217625 remove declarations of undefined methods r?padenot

https://reviewboard.mozilla.org/r/23011/#review20593
Attachment #8677821 - Flags: review?(padenot) → review+
Comment on attachment 8677822 [details]
MozReview Request: bug 1217625 remove unused MessageQueue() and document message queue thread access r?padenot

https://reviewboard.mozilla.org/r/23013/#review20595
Attachment #8677822 - Flags: review?(padenot) → review+
Comment on attachment 8677823 [details]
MozReview Request: bug 1217625 add a means to schedule a callback after processing on the graph thread r?padenot

https://reviewboard.mozilla.org/r/23015/#review20599
Attachment #8677823 - Flags: review?(padenot) → review+
(In reply to Karl Tomlinson (ni?:karlt) from comment #8)
> Paul, I suspect you already have plenty to do with TPAC approaching, so feel
> free to delay these reviews till things settle down, if you like.

I had a look and r+ed the easy ones, I'll have another look at this tomorrow on the plane.
Rank: 5
(Assignee)

Updated

3 years ago
Keywords: leave-open
Comment on attachment 8677824 [details]
MozReview Request: bug 1217625 perform checks for transition to inactive outside of stream processing r?padenot

https://reviewboard.mozilla.org/r/23017/#review21483
Attachment #8677824 - Flags: review?(padenot) → review+
Comment on attachment 8677825 [details]
MozReview Request: bug 1217625 remove ADD_STREAM_SUSPENDED r?padenot

https://reviewboard.mozilla.org/r/23019/#review21485
Attachment #8677825 - Flags: review?(padenot) → review+
Comment on attachment 8677826 [details]
MozReview Request: bug 1217625 suspend inactive AudioNodeStreams r?padenot

https://reviewboard.mozilla.org/r/23021/#review21487
Attachment #8677826 - Flags: review?(padenot) → review+
(Assignee)

Updated

3 years ago
Flags: in-testsuite-
(Assignee)

Updated

3 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Keywords: leave-open
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.