# Debugging CPU spikes in audio host

**URL:** <https://forum.juce.com/t/debugging-cpu-spikes-in-audio-host/36501>\
**Category:** General JUCE discussion\
**Created:** [December 4, 2019, 6:56pm UTC](https://forum.juce.com/t/debugging-cpu-spikes-in-audio-host/36501 "2019-12-04T18:56:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheWaveWarden](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/thewavewarden/32/13708_2.png) [@TheWaveWarden](https://forum.juce.com/u/TheWaveWarden)\
**Post date:** [December 4, 2019, 6:56pm UTC](https://forum.juce.com/t/debugging-cpu-spikes-in-audio-host/36501/1 "2019-12-04T18:56:53Z")

</div>

Upon alpha-testing my synth, I realized that it will sometimes produce CPU-spikes.  
The CPU-meter in the host is usually in the low range, but it suddenly skyrockets for what seems to be a single sample. The result is a very noticeable click of course as the buffer is not completed.

The strange thing about it is that it is in no way reproducable (happens at random) but seems to be strongly encouraged by using parameter automation inside the host.

Now I’m unsure how to tackle this issue, and I’ve known about this for a few months now.

Is there some flag that is set if a buffer is not completed in time? I remember there being a name for this “buffer not completed in time” kind of event but can’t think of it. Or any other suggestion how to resolve this issue?

---

<div class="post-metadata">

**Author:** ![matt](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/matt/32/18340_2.png) [@matt](https://forum.juce.com/u/matt)\
**Post date:** [December 4, 2019, 7:02pm UTC](https://forum.juce.com/t/debugging-cpu-spikes-in-audio-host/36501/2 "2019-12-04T19:02:25Z")

</div>

Might be caused by floating-point denormals? But really you’ll just have to profile it.

> [@State of the Art Denormal Prevention](https://forum.juce.com/t/state-of-the-art-denormal-prevention/16802/4):
>
> Oh yes, i didn't realized there is something similar. However, this also adds (similar)&nbsp;&nbsp;DAZ (Denormals are Zero) flag, and resets the old behavior.&nbsp; And&nbsp;FloatVectorOperations is maybe misleading, because the newer compilers (from VS2012, XCode) using SSE for all float-operations per default. &nbsp; How to check if denormals are currently used: &nbsp;&nbsp;float f=std::numeric\_limits\<float\>::min()\*0.5f;&nbsp; &nbsp; jassert (f==0);&nbsp;//&nbsp;you cannot do this in a one line, would be optimized away &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double…

Matt
