After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 600922 - gst-launch: wake up less often to check for Ctrl-C
gst-launch: wake up less often to check for Ctrl-C
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 0.10.26
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-11-06 05:14 UTC by bgao1
Modified: 2009-11-16 08:10 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description bgao1 2009-11-06 05:14:42 UTC
By default, when I play a media file via gstreamer command line (i.e. gst-launch), and check wakeups-from-idle per second from Powertop, I see 20 wakes from gstreamer. 

To be power friendly, we can enhance it by replaing
g_timeout_add (50, (GSourceFunc) check_intr, pipeline);
with:
g_timeout_add_seconds (1, (GSourceFunc) check_intr, pipeline);
in function "static EventLoopResult event_loop()" of file gstreamer/tools/gst-launch.c.

The one second checking interval is enough to capture user CTRL+C without perceivable lag.

This will bring power saving because CPU can reside in deep C state for a longer time.
Comment 1 Tim-Philipp Müller 2009-11-07 20:37:38 UTC
gst-launch is primarily a debugging and testing tool and as such it is not supposed to be memory or cpu efficient or even provide exemplary code.

I don't quite share your assertion that a one-second interval is enough to capture Ctrl-C "without perceivable lag". 250ms, however, seemed quite acceptable and should reduce wakeups a lot.

g_timeout_add_seconds() makes sense in a more complex scenario where multiple timeouts that are multiples of 1s are in use, but this is not the case in gst-launch, so I don't see a strong case for using it here.

I hope reducing the wakeups to 4 times per second is acceptable to you.

 commit ed86995cd80e390e6e4e0f78350b386b1d7797d5
 Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
 Date:   Sat Nov 7 20:22:49 2009 +0000

    gst-launch: wake up less often to check if we've been interrupted
    
    Check if we've been interrupted only four times per second instead
    of twenty times per second, to wake up the cpu less often and
    save power (see bug #600922).
Comment 2 bgao1 2009-11-16 08:10:22 UTC
This sounds good to me. Thanks!