o-marshmallow / PocketCHIP-pocket-home

PocketCHIP home screen: shows status, opens programs, changes settings
128 stars 32 forks source link

Constantly eating CPU #33

Open dos1 opened 5 years ago

dos1 commented 5 years ago

strace gets spammed with endlessly repeated reads:

select(7, [5 6], NULL, NULL, {0, 2000000}) = 1 (in [5], left {1, 993426})
read(5, "\377", 1)                      = 1
clock_gettime(CLOCK_MONOTONIC, {125502, 262125516}) = 0
clock_gettime(CLOCK_MONOTONIC, {125502, 263519917}) = 0
futex(0x27633c, FUTEX_CMP_REQUEUE_PI_PRIVATE, 1, 2147483647, 0x276368, 16235768) = 1
futex(0x276368, FUTEX_UNLOCK_PI_PRIVATE, 32) = 0
futex(0x1f8680, FUTEX_UNLOCK_PI_PRIVATE, 33) = 0
recvmsg(6, 0xbed908fc, 0)               = -1 EAGAIN (Resource temporarily unavailable)
read(5, "\377", 1)                      = 1
clock_gettime(CLOCK_MONOTONIC, {125502, 270397336}) = 0
clock_gettime(CLOCK_MONOTONIC, {125502, 270601792}) = 0
futex(0x27633c, FUTEX_CMP_REQUEUE_PI_PRIVATE, 1, 2147483647, 0x276368, 16235772) = 1
futex(0x276368, FUTEX_UNLOCK_PI_PRIVATE, 32) = 0
futex(0x1f8680, FUTEX_UNLOCK_PI_PRIVATE, 33) = 0
recvmsg(6, 0xbed908fc, 0)               = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(6, 0xbed9084c, 0)               = -1 EAGAIN (Resource temporarily unavailable)

/proc/PID/fd shows that fds 5 and 6 are both some unix sockets

dos1 commented 5 years ago

I've dug a bit into the code and it turns out that it's mostly JUCE timers constantly waking up. There's some amount of timers with timeout as low as 10ms! It's absolutely unacceptable in a launcher for battery operated, single-core device.

Not sure how much of it comes from pocket-home, and how much from JUCE itself.

dos1 commented 5 years ago

https://github.com/WeAreROLI/JUCE/issues/526