Odd CPU usage

Posted on
Sun Oct 08, 2017 11:52 pm
bkmar1192 offline
Posts: 274
Joined: Sep 12, 2015

Odd CPU usage

I have a very odd thing happening with my Security Camera plugin - from what I can tell this is a relatively new occurrence (over the last few days). When my Security Camera plugin is not running the CPU usage for all of the other plugins I am running are tracking at about .5 - 1.5 CPU.

When I turn on my Security Camera plugin it runs between 100-110 cpu (I have 6 cameras running with motion so it has been running around 60 cpu so this is a bit higher than expected). But what is really weird is that several of the other plugins jump up to 24 - 25 cpu. Then the Indigo server also jumps to 75-90 cpu. This obviously causes lots of problems and slow downs.

When I turn off the Security Camera Plugin, the other plugins go back down to their .5-1.5 CPU and server goes back down to 11.

The Security Camera plugin shouldn't have any connection to the other plugins - why is it causing those other plugins to spike in CPU usage?

-Bert

Posted on
Wed Oct 11, 2017 8:42 am
bkmar1192 offline
Posts: 274
Joined: Sep 12, 2015

Re: Odd CPU usage

I figured out the problem - so in case others have this issue I'll explain my self imposed critical bug.

Each camera has its own thread so they run independently of each other. Each thread has a "while true" loop that captures and processes the cameras image and determines motion.

I was doing some bug fixes that surfaced after the 2.0 release. As part of that I moved a delay from the end of the while loop to the beginning. Except I moved it before the loop not in the loop. So the loop was running constantly with no pause. There is a lot of file processing in my plugin so running that constantly across six cameras was wrecking havoc on CPU use.

Not sure why it affected the other plugins as well but in general Indigo did not like it and CPU would spike to the point where a couple of times I had to hard reset the server.

Fortunately this bug does not exist in the currently released version.


Sent from my iPhone using Tapatalk

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests

cron