scim-launcher select() shorts timeouts causes too much CPU wakeups

Bug #122445 reported by Benjamin Pineau
2
Affects Status Importance Assigned to Milestone
scim (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: scim

Note: this problem is fixed upstream, and the fix is integrated on the new scim release (scim 0.4.7). I report the bug here so Ubuntu do consider either updating the scim package for Gutsy release, or backport the fix (this is just a few line diff).

PowerTOP tool (http://www.linuxpowertop.org/), revealed that scim-launcher is on the top battery drains on laptops, by causing a total of 13 or 14 CPU wakeups from idle per second (10 from a scim-launcher process, and 3/4 from scim-panel-gtk). Asking on the powertop's IRC channel, an other SCIM user confirmed this behaviour on his system (confirmed again by an other friend by email).

The main problem (for the 10 wakeups/second part) stands in modules/FrontEnd/scim_x11_frontend.cpp (lines 460 to 503), where a select() is run in an infinite loop (in "while (!m_should_exit)") with a very short timeout of 0.1 second (100000 usec). This select() is restarted after every timeout unless a global variable (m_should_exit)
is modified by an external source.

I didn't yet investigated the cause of the 3-4 scim-panel-gtk's wakeups (strace shows a loop of gettimeofday() and poll() calls). Fixing those problems should significantly improve batteries lifetime for SCIM users (by default on Ubuntu, every Chinese and Japanese user) out there.

Revision history for this message
Ming Hua (minghua) wrote :

Thanks for reporting this reminder. I'll add a note in debian/changelog about this when I upload 1.4.7 to Debian (which should be soon).

Revision history for this message
Ming Hua (minghua) wrote :

Scim 1.4.7-1 was just uploaded to Debian unstable today. Please contact some Ubuntu developer to merge with Debian to fix this bug.

Revision history for this message
Jonathan Riddell (jr) wrote :

scim (1.4.7-1ubuntu1) gutsy; urgency=low

  * Merge with Debian for new upstream, remaining changes:
   - Adds kubuntu_01_hide_in_kde.dpatch, removed the scim-setup entry in
     Kmenu, since that duplicates with skim
   - Move usr/lib/libscim-gtkutils-1.0.so.8 and
     usr/lib/libscim-gtkutils-1.0.so.8.* to scim-gtk2-immodule.
   - Add scim-gtk2-immodule to libscim-dev's Depends, LP: #42024.
   - Set Maintainer to Ubuntu Core developers
   - debian/patches/20_scim_config.dpatch:
    - Enable Trigger keys with CJK native keys (ubuntu: #37687),

scim (1.4.7-2) UNRELEASED; urgency=low

  * Don't install desktop entry scim-setup.desktop in deprecated location
    /usr/share/control-center-2.0/capplets/ anymore.
    - Add 10_remove-deprecated-desktop-entry dpatch to remove relevant part in
      extras/setup/Makefile.am.
    - Regenerate 90_relibtoolize dpatch.
    - Remove the "usr/share/control-center-2.0/capplets/scim-setup.desktop"
      line in debian/scim.install.

scim (1.4.7-1) unstable; urgency=low

  The "keeping up with upstream" release.

  * New upstream release.
    - Include missing header, this time <cstring>, for a few files, to make
      scim buildable with (the constantly evolving) GCC 4.3.
      (Closes: #417686, again)
    - Remove an infinite loop with 0.1 second timeout in the X11 frontend to
      avoid waking up CPU constantly, therefore preserve power consumption and
      extend laptop battery life. (Fixes LP: #122445)
    - Change 10_gtk-immodule-install-dir dpatch to patch configure.ac instead
      of extras/gtk2_immodule/Makefile.am, to adapt to the upstream change.
    - Regenerate 90_relibtoolize dpatch. Also adjust the timestamp touching
      in debian/rules accordingly.
  * Clarify build dependency.
    - Remove intltool as upstream tarball ships its own 0.33 version.
    - Add libpango1.0-dev, libglib2.0-dev, and pkg-config explicitly (used to
      be pulled in by libgtk2.0-dev).
  * Add libx11-dev as a dependency of libscim-dev explicitly, it used to be
    pulled in by libgtk2.0-dev.
  * Add scim-thai to scim's "Suggests:" list.
  * Add "-W -g" compiler flags back. The warnings are somehow useful when
    reading the build logs, and the debug information will be useful for
    manually built packages with DEB_BUILD_OPTIONS=nostrip.
  * Change maintainer's email address.

 -- Jonathan Riddell <email address hidden> Wed, 25 Jul 2007 13:37:03 +0100

Changed in scim:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.