Ardour  9.0-pre0-582-g084a23a80d
TimerTest Class Reference

#include <timer_test.h>

Inheritance diagram for TimerTest:
[legend]

Public Member Functions

 TimerTest ()
 
void _testGlibTimeoutSources ()
 
void _testGlibmmSignalTimeouts ()
 
void _testGlibmmTimeoutSources ()
 
void _testTimers ()
 
void _testTimersIdleFrequency ()
 
void _testTimersBlockIdle ()
 
void testGlibTimeoutSources ()
 
void testGlibmmSignalTimeouts ()
 
void testGlibmmTimeoutSources ()
 
void testTimers ()
 
void testTimersIdleFrequency ()
 
void testTimersBlockIdle ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (TimerTest)
 
 CPPUNIT_TEST (testGlibTimeoutSources)
 
 CPPUNIT_TEST (testGlibmmSignalTimeouts)
 
 CPPUNIT_TEST (testGlibmmTimeoutSources)
 
 CPPUNIT_TEST (testTimers)
 
 CPPUNIT_TEST (testTimersIdleFrequency)
 
 CPPUNIT_TEST (testTimersBlockIdle)
 
 CPPUNIT_TEST_SUITE_END ()
 
bool on_idle_handler ()
 
bool on_quit_handler ()
 
void on_second_timeout ()
 
void on_fast_timeout ()
 
void on_rapid1_timeout ()
 
void on_rapid2_timeout ()
 
bool on_second_timeout_glibmm ()
 
bool on_fast_timeout_glibmm ()
 
bool on_rapid1_timeout_glibmm ()
 
bool on_rapid2_timeout_glibmm ()
 
void start_timing ()
 
void reset_timing ()
 
void reset_timing_run_main ()
 
void connect_idle_handler ()
 
void connect_quit_timeout ()
 

Static Private Member Functions

static guint64 second_timer_usecs ()
 
static guint64 fast_timer_usecs ()
 
static guint64 rapid1_timer_usecs ()
 
static guint64 rapid2_timer_usecs ()
 
static guint64 second_timer_ms ()
 
static guint64 fast_timer_ms ()
 
static guint64 rapid1_timer_ms ()
 
static guint64 rapid2_timer_ms ()
 
static guint64 test_length_ms ()
 
static gboolean _second_timeout_handler (void *)
 
static gboolean _fast_timeout_handler (void *)
 
static gboolean _rapid1_timeout_handler (void *)
 
static gboolean _rapid2_timeout_handler (void *)
 
static void simulate_load (const std::string &name, guint64 time_usecs)
 

Private Attributes

std::string m_current_test_name
 
bool m_connect_idle
 
bool m_block_idle
 
Glib::RefPtr< Glib::MainLoop > m_main
 
Glib::RefPtr< Glib::MainContext > m_context
 
PBD::TimingData m_idle_timing_data
 
PBD::TimingData m_second_timing_data
 
PBD::TimingData m_fast_timing_data
 
PBD::TimingData m_rapid1_timing_data
 
PBD::TimingData m_rapid2_timing_data
 

Detailed Description

The main point of this test is to the compare the different ways of setting a timeout with glib and glibmm and the PBD::Timers class and then to test them all again with the maximum multimedia timer resolution(1ms) set with timeBeginPeriod on Windows.

The test demonstrates that when using Glibmm TimeoutSources the frequency of the timers is different that using Glib based timeouts. In Ardour that resulted in a noticable increase in CPU Usage, but behaviour may vary.

The other thing being tested is what effect adding two short timeouts(<40ms) to a glib context has on the idle timeout on Windows.

Glib Timeout sources run at a higher priority than the idle handler, so the more work performed in the timeout handlers the less frequent the idle handler will run until doesn't get scheduled at all. The consequence of this is blocking the UI.

Similarily because timeout sources and UI updates/rendering occur in the same context in Gtk the length of expose/draw operations will affect the accuracy of the timeouts.

Definition at line 33 of file timer_test.h.

Constructor & Destructor Documentation

◆ TimerTest()

TimerTest::TimerTest ( )
inline

Definition at line 54 of file timer_test.h.

Member Function Documentation

◆ _fast_timeout_handler()

static gboolean TimerTest::_fast_timeout_handler ( void *  )
staticprivate

◆ _rapid1_timeout_handler()

static gboolean TimerTest::_rapid1_timeout_handler ( void *  )
staticprivate

◆ _rapid2_timeout_handler()

static gboolean TimerTest::_rapid2_timeout_handler ( void *  )
staticprivate

◆ _second_timeout_handler()

static gboolean TimerTest::_second_timeout_handler ( void *  )
staticprivate

◆ _testGlibmmSignalTimeouts()

void TimerTest::_testGlibmmSignalTimeouts ( )

◆ _testGlibmmTimeoutSources()

void TimerTest::_testGlibmmTimeoutSources ( )

◆ _testGlibTimeoutSources()

void TimerTest::_testGlibTimeoutSources ( )

◆ _testTimers()

void TimerTest::_testTimers ( )

◆ _testTimersBlockIdle()

void TimerTest::_testTimersBlockIdle ( )

◆ _testTimersIdleFrequency()

void TimerTest::_testTimersIdleFrequency ( )

◆ connect_idle_handler()

void TimerTest::connect_idle_handler ( )
private

◆ connect_quit_timeout()

void TimerTest::connect_quit_timeout ( )
private

◆ CPPUNIT_TEST() [1/6]

TimerTest::CPPUNIT_TEST ( testGlibmmSignalTimeouts  )
private

◆ CPPUNIT_TEST() [2/6]

TimerTest::CPPUNIT_TEST ( testGlibmmTimeoutSources  )
private

◆ CPPUNIT_TEST() [3/6]

TimerTest::CPPUNIT_TEST ( testGlibTimeoutSources  )
private

◆ CPPUNIT_TEST() [4/6]

TimerTest::CPPUNIT_TEST ( testTimers  )
private

◆ CPPUNIT_TEST() [5/6]

TimerTest::CPPUNIT_TEST ( testTimersBlockIdle  )
private

◆ CPPUNIT_TEST() [6/6]

TimerTest::CPPUNIT_TEST ( testTimersIdleFrequency  )
private

◆ CPPUNIT_TEST_SUITE()

TimerTest::CPPUNIT_TEST_SUITE ( TimerTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

TimerTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ fast_timer_ms()

static guint64 TimerTest::fast_timer_ms ( )
inlinestaticprivate

Definition at line 99 of file timer_test.h.

◆ fast_timer_usecs()

static guint64 TimerTest::fast_timer_usecs ( )
inlinestaticprivate

Definition at line 87 of file timer_test.h.

◆ on_fast_timeout()

void TimerTest::on_fast_timeout ( )
private

◆ on_fast_timeout_glibmm()

bool TimerTest::on_fast_timeout_glibmm ( )
private

◆ on_idle_handler()

bool TimerTest::on_idle_handler ( )
private

◆ on_quit_handler()

bool TimerTest::on_quit_handler ( )
private

◆ on_rapid1_timeout()

void TimerTest::on_rapid1_timeout ( )
private

◆ on_rapid1_timeout_glibmm()

bool TimerTest::on_rapid1_timeout_glibmm ( )
private

◆ on_rapid2_timeout()

void TimerTest::on_rapid2_timeout ( )
private

◆ on_rapid2_timeout_glibmm()

bool TimerTest::on_rapid2_timeout_glibmm ( )
private

◆ on_second_timeout()

void TimerTest::on_second_timeout ( )
private

◆ on_second_timeout_glibmm()

bool TimerTest::on_second_timeout_glibmm ( )
private

◆ rapid1_timer_ms()

static guint64 TimerTest::rapid1_timer_ms ( )
inlinestaticprivate

Definition at line 102 of file timer_test.h.

◆ rapid1_timer_usecs()

static guint64 TimerTest::rapid1_timer_usecs ( )
inlinestaticprivate

Definition at line 90 of file timer_test.h.

◆ rapid2_timer_ms()

static guint64 TimerTest::rapid2_timer_ms ( )
inlinestaticprivate

Definition at line 105 of file timer_test.h.

◆ rapid2_timer_usecs()

static guint64 TimerTest::rapid2_timer_usecs ( )
inlinestaticprivate

Definition at line 93 of file timer_test.h.

◆ reset_timing()

void TimerTest::reset_timing ( )
private

◆ reset_timing_run_main()

void TimerTest::reset_timing_run_main ( )
private

◆ second_timer_ms()

static guint64 TimerTest::second_timer_ms ( )
inlinestaticprivate

Definition at line 96 of file timer_test.h.

◆ second_timer_usecs()

static guint64 TimerTest::second_timer_usecs ( )
inlinestaticprivate

Definition at line 84 of file timer_test.h.

◆ simulate_load()

static void TimerTest::simulate_load ( const std::string &  name,
guint64  time_usecs 
)
staticprivate

◆ start_timing()

void TimerTest::start_timing ( )
private

◆ test_length_ms()

static guint64 TimerTest::test_length_ms ( )
inlinestaticprivate

Definition at line 108 of file timer_test.h.

◆ testGlibmmSignalTimeouts()

void TimerTest::testGlibmmSignalTimeouts ( )

◆ testGlibmmTimeoutSources()

void TimerTest::testGlibmmTimeoutSources ( )

◆ testGlibTimeoutSources()

void TimerTest::testGlibTimeoutSources ( )

◆ testTimers()

void TimerTest::testTimers ( )

◆ testTimersBlockIdle()

void TimerTest::testTimersBlockIdle ( )

◆ testTimersIdleFrequency()

void TimerTest::testTimersIdleFrequency ( )

Member Data Documentation

◆ m_block_idle

bool TimerTest::m_block_idle
private

Definition at line 114 of file timer_test.h.

◆ m_connect_idle

bool TimerTest::m_connect_idle
private

Definition at line 113 of file timer_test.h.

◆ m_context

Glib::RefPtr<Glib::MainContext> TimerTest::m_context
private

Definition at line 142 of file timer_test.h.

◆ m_current_test_name

std::string TimerTest::m_current_test_name
private

Definition at line 111 of file timer_test.h.

◆ m_fast_timing_data

PBD::TimingData TimerTest::m_fast_timing_data
private

Definition at line 149 of file timer_test.h.

◆ m_idle_timing_data

PBD::TimingData TimerTest::m_idle_timing_data
private

Definition at line 147 of file timer_test.h.

◆ m_main

Glib::RefPtr<Glib::MainLoop> TimerTest::m_main
private

Definition at line 141 of file timer_test.h.

◆ m_rapid1_timing_data

PBD::TimingData TimerTest::m_rapid1_timing_data
private

Definition at line 150 of file timer_test.h.

◆ m_rapid2_timing_data

PBD::TimingData TimerTest::m_rapid2_timing_data
private

Definition at line 151 of file timer_test.h.

◆ m_second_timing_data

PBD::TimingData TimerTest::m_second_timing_data
private

Definition at line 148 of file timer_test.h.


The documentation for this class was generated from the following file: