Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#11250 closed Patch - Feature (fixed)

Reduce ThreadedFileWriter thread wakeup

Reported by: Rune Petersen <rune@…> Owned by: danielk
Priority: minor Milestone: 0.27
Component: MythTV - General Version: 0.26-fixes
Severity: medium Keywords:
Cc: Ticket locked: no


The writer thread will only write in chunks of 'kMinWriteSize' or larger. Currently ThreadedFileWriter::Write() will wake up the writer thread every time, even if the chunk size condition isn't met.

The patch changes ThreadedFileWriter::Write() to only wake up the writer thread is the chunk size condition is met.

This reduces cpu usage by ~9% on a 700MHz Cortex-A9 when recording DVB HD content.

Attachments (1)

mythtv_ThreadedFileWriter_reduce_thread_wakeup.patch (630 bytes) - added by Rune Petersen <rune@…> 8 years ago.

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by Rune Petersen <rune@…>

comment:1 Changed 8 years ago by danielk

Owner: set to danielk
Status: newaccepted

comment:2 Changed 8 years ago by Daniel Thor Kristjansson <dkristjansson@…>

Resolution: fixed
Status: acceptedclosed

In 8c4434a25a0c002bbfa971b90083e515a37d3f9c/mythtv:

Reduce ThreadedFileWriter? wakeups.

Fixes #11250. If there isn't enough data to actually bother writing
it to disk don't wake up the writer thread.

comment:3 Changed 8 years ago by Rune Petersen <rune@…>

Just my 2 cent:

I personally find "(writeBuffers.size() > 1)" is redundant and causes allot of bufferHasData.wakeAll() calls, but I can see that it is hard to prove it is safe.

overall it is still an improvement, thank you.

comment:4 Changed 8 years ago by Raymond Wagner

Milestone: unknown0.27
Note: See TracTickets for help on using tickets.