SDL 2.0.5, Linux.
I am wondering why after calling SDL_OpenAudioDevice()
the program starts to consume nearly 100% of CPU time of one core.
Even this highly simplified program will make it:
The Audio Device starts paused, it does not play anything. I did strace
on one of the threads with 100% CPU usage and this is what I saw:
Trace of process 10070 - ./sdl_audio
getpid() = 10067
getpid() = 10067
getpid() = 10067
poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
getpid() = 10067
getpid() = 10067
getpid() = 10067
poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
getpid() = 10067
getpid() = 10067
getpid() = 10067
poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
getpid() = 10067
getpid() = 10067
getpid() = 10067
poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
getpid() = 10067
getpid() = 10067
getpid() = 10067
poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
getpid() = 10067
getpid() = 10067
futex(0x55b3d0e0e6f0, FUTEX_LOCK_PI_PRIVATE, NULL) = 0
getpid() = 10067
futex(0x55b3d0e0e6f0, FUTEX_UNLOCK_PI_PRIVATE) = 0
getpid() = 10067
getpid() = 10067
write(6, "W", 1) = 1
getpid() = 10067
getpid() = 10067
read(3, "xxxxxxxxxx", 10) = 10
read(3, "xxxxxxx", 10) = 7
read(3, 0x7f1845272c9e, 10) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x55b3d0e0e6f0, FUTEX_UNLOCK_PI_PRIVATE) = 0
poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, 1000) = 1 ([{fd=3, revents=POLLIN}])
getpid() = 10067
getpid() = 10067
getpid() = 10067
poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
getpid() = 10067
getpid() = 10067
getpid() = 10067
poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
getpid() = 10067
getpid() = 10067
getpid() = 10067
poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
getpid() = 10067
getpid() = 10067
getpid() = 10067
poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
getpid() = 10067
getpid() = 10067
Is it normal that even idling audio subsystem consumes 100% of the CPU time of one core?