Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#7953 closed patch (fixed)

Reduce mythfrontend CPU usage on idle screens

Reported by: Jim Stichnoth <stichnot@…> Owned by: Isaac Richards
Priority: major Milestone: 0.23
Component: MythTV - General Version: head
Severity: medium Keywords:
Cc: Ticket locked: yes

Description

Many people have observed that mythfrontend consumes a surprising amount of CPU time while sitting idle on a screen even as simple as the main menu. The reported CPU usage is usually either 7% or 14%. This is due to the QTimer implementation which is used for the 70Hz MythMainWindowPrivate::drawTimer. To get the best possible precision, QTimer may spend the last 1-2ms busy-waiting before the timeout signal.

This excess CPU usage can be a real issue for a combined FE/BE machine. Also, it adds to the CPU requirements during playback because the drawTimer is not stopped during playback.

The attached patch uses a simple timer class based on usleep(). On my ION system, idle frontend CPU usage drops from 7% to around 1%, according to "top".

Attachments (2)

reduce_idle_cpu_usage.patch (2.2 KB) - added by Jim Stichnoth <stichnot@…> 15 years ago.
7953-v1.patch (2.3 KB) - added by danielk 15 years ago.
thread-safe version

Download all attachments as: .zip

Change History (7)

Changed 15 years ago by Jim Stichnoth <stichnot@…>

Attachment: reduce_idle_cpu_usage.patch added

comment:1 Changed 15 years ago by cpinkham

Milestone: unknown0.23
Priority: minormajor
Version: unknownhead

Not sure if this exact solution will be implemented, but if this reduces CPU usage while idle, it will definitely be looked at before 0.23.

Changed 15 years ago by danielk

Attachment: 7953-v1.patch added

thread-safe version

comment:2 Changed 15 years ago by danielk

Resolution: fixed
Status: newclosed

(In [23304]) Fixes #7953. Reduce CPU usage in MythUI by 70 ms per second by using a replacement timer class.

Note: I'm hoping this can be fixed upstream quickly so we can eventually get rid of this workaround. This is appears to be the root cause for a number of lost cycles on my laptop's KDE desktop.

comment:3 Changed 15 years ago by anonymous

I noticed the upstream QTimer bug has been marked fixed for QT 4.6.x, and newer distributions like Ubuntu Lucid are shipping QT 4.6.x. Can we try going back to a QTimer and see what the CPU usage is?

comment:4 in reply to:  3 Changed 15 years ago by anonymous

Replying to anonymous:

I noticed the upstream QTimer bug has been marked fixed for QT 4.6.x, and newer distributions like Ubuntu Lucid are shipping QT 4.6.x. Can we try going back to a QTimer and see what the CPU usage is?

Specifically: http://bugreports.qt.nokia.com/browse/QTBUG-7618

comment:6 Changed 15 years ago by stuartm

Ticket locked: set

Nokia failed to understand the problem and their fix doesn't actually deal with the issue. So no, we can't go back to QTimer

Also, Trac is a not a discussion forum.

Note: See TracTickets for help on using tickets.