PATCH2/2: bluez-utils - avoid-unnecessary-polls
Hello again,
here's the second patch to ALSA A2DP plugin in bluez-utils (see my previous mail).
This patch changes the worker thread poll timeout to be calculated according to application chosen period size. This allows to decrease the CPU load significantly for those applications that do not require an ultra small period size. Without the patch (poll timeout of 1msec), the system call load is pretty heavy...
Br,
Signature · 1 line
[email protected] (Kai Vehmanen)
audio/pcm_bluetooth.c +7 -1
@@ -168,12 +168,17 @@double period_time;struct timeval start;struct pollfd fds[2 ]; +int poll_timeout; fds[0 ] = data->server; fds[1 ] = data->stream; prev_periods =0 ; period_time =1000000.0 * data->io.period_size / data->io.rate; +if (period_time > (int )(MIN_PERIOD_TIME *1000 )) + poll_timeout = (int )(period_time /1000.0f ); +else + poll_timeout =MIN_PERIOD_TIME ;gettimeofday (&start,0 );
@@ -214,7 +219,8 @@ } iter_sleep: - ret =poll (fds,2 ,MIN_PERIOD_TIME ); +/* sleep up to one period interval */ + ret =poll (fds,2 , poll_timeout);if (ret <0 ) {SNDERR ("poll error: %s (%d)" ,strerror (errno), errno);if (errno !=EINTR )
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Luiz Augusto von Dentz
maintainerHi Kai,
Quoted 11 lines · Kai Vehmanen
Hello again,
here's the second patch to ALSA A2DP plugin in bluez-utils (see my previous mail).
This patch changes the worker thread poll timeout to be calculated according to application chosen period size. This allows to decrease the CPU load significantly for those applications that do not require an ultra small period size. Without the patch (poll timeout of 1msec), the system call load is pretty heavy...
This was done before but I guess for some reason I don't remember now we remove it in favor of fixed timeout. Thought we should reconsider it if it has a good impact on CPU load.
-- =
Luiz Augusto von Dentz
Engenheiro de Computa=E7=E3o
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel