Decrease CPU usage of datetime by events

Bug #1533911 reported by Bartosz Kosiorek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
indicator-datetime (Ubuntu)
Triaged
Low
Unassigned

Bug Description

Currently in ./src/wakeup-timer-mainloop.cpp
the g_timeout_add_full function is used to call intervals:

        const auto now = m_clock->localtime();
        const auto difference_usec = g_date_time_difference(m_wakeup_time.get(), now.get());
        const guint interval_msec = std::abs(difference_usec) / 1000u;
        g_debug("%s setting wakeup timer to kick at %s, which is in %zu seconds",
                G_STRFUNC,
                m_wakeup_time.format("%F %T").c_str(),
                size_t{interval_msec/1000});

        m_timeout_tag = g_timeout_add_full(G_PRIORITY_HIGH,
                                           interval_msec,
                                           on_timeout,
                                           this,
                                           nullptr);
More information:
 https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-timeout-add-full

The grouping of timers to fire at the same time results in a more power and CPU efficient behavior
That's why I would recommend to use:
   g_timeout_add_seconds_full ()
instead

Revision history for this message
Charles Kerr (charlesk) wrote :

Good suggestion! Thanks Bartosz.

Changed in indicator-datetime (Ubuntu):
assignee: nobody → Charles Kerr (charlesk)
importance: Undecided → Low
status: New → Triaged
Changed in indicator-datetime (Ubuntu):
assignee: Charles Kerr (charlesk) → nobody
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.