[mythtv-commits] Ticket #11252: Reduce DeviceReadBuffer thread wakeup

MythTV noreply at mythtv.org
Thu Nov 22 21:58:29 UTC 2012


#11252: Reduce DeviceReadBuffer thread wakeup
------------------------------------+----------------------------------
 Reporter:  Rune Petersen <rune@…>  |           Type:  Patch - Feature
   Status:  new                     |       Priority:  minor
Milestone:  unknown                 |      Component:  MythTV - General
  Version:  0.26-fixes              |       Severity:  medium
 Keywords:                          |  Ticket locked:  0
------------------------------------+----------------------------------
 This patch affects 2 threads:
  - DeviceReadBuffer reader thread.
  - The (DVB/ASI)StreamHandler thread.


 === DeviceReadBuffer reader thread: ===
 The reader thread will continually poll and read from the device when data
 is available.
 Depending on the driver this will result in the thread will wake up and
 read() 700+ times a second with a reads of ~2KB (DVB HD content).

 The patch calls usleep(1000) if a read is less than 'dev_read_size/2'

 This reduces the thread to ~200 read() calls a second with reads of 7-8KB
 (DVB HD content).


 === The (DVB/ASI)StreamHandler thread: ===

 The thread will continually call DeviceReadBuffer::Read() and then process
 the content.
 Currently DeviceReadBuffer::Read() will return if more than 4*188 bytes is
 available in the buffer (timeout 500ms.)
 This results in DeviceReadBuffer::Read() being called 700+ times a second
 with a reads of ~2KB (DVB HD content).

 The patch changes DeviceReadBuffer::Read() to wait for more data (~24KB)
 and decrease the timeout to 20 ms.
 The timeout is now responsible for controlling the maximum latency of the
 data stream.

 This reduces the thread to ~70 DeviceReadBuffer::Read() calls a second
 with reads of 20KB (DVB HD content).


 The combined result if this patch reduces CPU usage by ~15% on a 700MHz
 Cortex-A9 when recording DVB HD content.

-- 
Ticket URL: <http://code.mythtv.org/trac/ticket/11252>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center


More information about the mythtv-commits mailing list