Opened 12 years ago

Closed 12 years ago

Last modified 3 years ago

#1623 closed bug (fixed)

ghci: 20 wakeups per second

Reported by: igloo Owned by: simonmar
Priority: normal Milestone: 6.8.1
Component: Runtime System Version: 6.6.1
Keywords: Cc: simonmar
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

From http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=438371 :

According to powertop on my laptop, ghci seems to wake up 20 times per
second looking for input when sitting at the command prompt.  This has
negative impact on battery life, as discussed on the powertop page.

I don't think the change in the HEAD to using timer_create rather than setitimer will have fixed this, but I can't currently run powertop so haven't been able to confirm that.

Change History (10)

comment:1 Changed 12 years ago by simonmar

Component: CompilerRuntime System
difficulty: UnknownEasy (1 hr)

Yes, the ticker is set to always fire N times a second (default 50). It's not "looking for input", it is used for context switching and profiling. Also this isn't specific to GHCi; all GHC-compiled programs will do this.

We should really turn off the ticker when the system is idle.

comment:2 Changed 12 years ago by simonmar

Owner: set to simonmar

I'm doing this

comment:3 Changed 12 years ago by simonmar

Resolution: fixed
Status: newclosed

Fixed:

Mon Sep  3 06:25:23 PDT 2007  Simon Marlow <simonmar@microsoft.com>
  * FIX #1623: disable the timer signal when the system is idle (threaded RTS only)

comment:4 Changed 12 years ago by igloo

Milestone: 6.8 branch6.8.1

comment:5 Changed 11 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:6 Changed 11 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:7 Changed 10 years ago by simonmar

difficulty: Easy (1 hr)Easy (less than 1 hour)

comment:8 Changed 8 years ago by marlowsd@…

commit dd24d6bc37879c6b32a3d5ac4ee765e59e13501c

Author: Simon Marlow <marlowsd@gmail.com>
Date:   Wed Apr 11 10:12:14 2012 +0100

    Disable the timer signal while blocked in select() (#5991)
    
    The threaded RTS had a fix for this a long time ago (#1623) but this
    patch applies a similar fix to the non-threaded RTS.

 rts/posix/Select.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

comment:9 Changed 3 years ago by bgamari

Cc: simonmar added
Type of failure: None/Unknown

This is still broken in the USE_PTHREAD_FOR_ITIMER codepath. See #11965.

comment:10 Changed 3 years ago by Ben Gamari <ben@…>

In 999c464/ghc:

rts/itimer/pthread: Stop timer when ticker is stopped

This reworks the pthread-based itimer implementation to disarm the timer
when events aren't needed. Thanks to hsyl20 for the nice design.

Test Plan: Validate

Reviewers: hsyl20, simonmar, austin

Reviewed By: simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2131

GHC Trac Issues: #1623, #11965
Note: See TracTickets for help on using tickets.