[mythtv] [PATCH] usleep difference in Live TV vs. recording

Jeremiah Morris jm at whpress.com
Sat Oct 16 22:33:45 UTC 2004


I've been doing some profiling for the Mac OS X build, and found that 
watching Live TV is much more CPU intensive than watching a recording.  
I tracked it down to the event loop thread.  When watching a recording, 
the event loop is maintained by playbackbox.cpp, 1402-1411:

         while (tv->GetState() != kState_None)
         {
             qApp->unlock();
             qApp->processEvents();
             usleep(10000);
             qApp->lock();
         }

When watching Live TV instead, the event loop is maintained by 
main.cpp, 289-295:

         while (tv->GetState() != kState_None)
         {
             qApp->unlock();
             qApp->processEvents();
             usleep(100);
             qApp->lock();
         }

Note the usleep() time difference.  During Live TV, the event loop 
would consume many more resources over the recording case, due to the 
excessive calls to processEvents().  Changing to usleep(10000) made the 
Live TV performance comparable to recording performance.

I can't see any reason why Live TV would need to process events 100 
times more frequently than in the recording case, so a patch is 
attached to raise the sleep time to 10000 usec.

- Jeremiah

-------------- next part --------------
A non-text attachment was scrubbed...
Name: frontend_main.diff
Type: application/text
Size: 489 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20041016/83ca4409/frontend_main.bin


More information about the mythtv-dev mailing list