CPU hogging in the current master
torvalds at linux-foundation.org
Wed Sep 25 20:19:16 UTC 2013
On Tue, Sep 24, 2013 at 11:57 AM, Robert C. Helling <helling at atdotde.de> wrote:
> given that the whole TTS calculation is about a hypothetical dive anyway (a dive that is abandoned at this point of time) let me suggest the following patch:
> This assumes the TTS is the same as for the last sample if the time since the last calculation of TTS is less than a factor of 1/TTS_ACCURACY (currently 300) than the TTS (i.e. if it takes a long time to the surface we don't have to check every second).
Quite frankly, I'd much rather just make the TTS "time_stepsize" be much bigger.
Right now it does that TTS deco calculation at 10s intervals, which
seems excessive. And for the test-case Lubomir pointed at, it ends up
spending all the time just calculating the pow() function for me.
So just changing the line
const int time_stepsize = 10;
to have some bigger granularity should make things much faster. Try
one-minute granularity at first.
That said, looking at the profiles, there's a few other things we
could/should do. For example, we spend a *lot* of time in pow().
That's a very expensive FP function, and add_segment() calls it a lot.
And we're being pretty damn stupid about it too.
Let me send out a trial patch to fix that up.
More information about the subsurface