JustPaste.it

Something wastes CPU cycles with looping (loads will go high even in idles)

Many programs is doing these.

OS: Devuan4 and Devuan5

strace -p PROGRAM_ID

futex(0x7f37ffca9ae8, FUTEX_WAKE_PRIVATE, 2147483647) = 1
write(33, "\372", 1)                    = 1
recvmsg(4, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=32, events=POLLIN}], 3, 0) = 1 ([{fd=32, revents=POLLIN}])
read(32, "\372", 1)                     = 1
recvmsg(4, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=32, events=POLLIN}], 3, 0) = 0 (Timeout)

strace -c -p PROGRAM_ID
(just a few seconds)

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 26,53    0,180864          31      5669           poll
 23,74    0,161786          86      1877       142 futex
 21,77    0,148381          20      7178      6209 recvmsg
  9,64    0,065723          34      1931           write
  9,18    0,062560          29      2115           read
  3,93    0,026804          58       456           mprotect
  2,65    0,018071          29       613           writev
  0,65    0,004430          49        90         6 newfstatat
  0,53    0,003594          26       136           gettid
  0,51    0,003490         872         4           munmap
  0,28    0,001917          40        47           madvise
  0,17    0,001130          31        36           close
  0,13    0,000891          63        14           fallocate
  0,09    0,000642          32        20           mmap
  0,08    0,000571           9        59           getpid
  0,05    0,000346          24        14           memfd_create
  0,02    0,000138         138         1           restart_syscall
  0,01    0,000100           5        18           dup
  0,01    0,000076          25         3           clone
  0,01    0,000069           6        10           fcntl
  0,00    0,000026           4         6           rt_sigprocmask
  0,00    0,000009           3         3           lseek
  0,00    0,000000           0        10         6 openat
------ ----------- ----------- --------- --------- ----------------
100,00    0,681618          33     20310      6363 total