Ardour  9.0-pre0-582-g084a23a80d
timer_test.h
Go to the documentation of this file.
1 #include <cppunit/TestFixture.h>
2 #include <cppunit/extensions/HelperMacros.h>
3 
4 #include "glibmm/main.h"
5 
6 #include "pbd/timing.h"
7 
33 class TimerTest : public CppUnit::TestFixture
34 {
42 #ifdef PLATFORM_WINDOWS
43  CPPUNIT_TEST (testGlibTimeoutSourcesHR);
44  CPPUNIT_TEST (testGlibmmSignalTimeoutsHR);
45  CPPUNIT_TEST (testGlibmmTimeoutSourcesHR);
46  CPPUNIT_TEST (testTimersHR);
47  CPPUNIT_TEST (testTimersIdleFrequencyHR);
48  CPPUNIT_TEST (testTimersBlockIdleHR);
49 #endif
51 
52 public:
53 
55  : m_connect_idle(false)
56  , m_block_idle(false)
57  { }
58 
62  void _testTimers ();
65 
69  void testTimers ();
72 
73 #ifdef PLATFORM_WINDOWS
74  void testGlibTimeoutSourcesHR ();
75  void testGlibmmSignalTimeoutsHR ();
76  void testGlibmmTimeoutSourcesHR ();
77  void testTimersHR ();
78  void testTimersIdleFrequencyHR ();
79  void testTimersBlockIdleHR ();
80 #endif
81 
82 private:
83 
84  static guint64 second_timer_usecs ()
85  { return 1000000; }
86 
87  static guint64 fast_timer_usecs ()
88  { return 100000; }
89 
90  static guint64 rapid1_timer_usecs ()
91  { return 40000; }
92 
93  static guint64 rapid2_timer_usecs ()
94  { return 15000; }
95 
96  static guint64 second_timer_ms ()
97  { return second_timer_usecs () / 1000; }
98 
99  static guint64 fast_timer_ms ()
100  { return fast_timer_usecs () / 1000; }
101 
102  static guint64 rapid1_timer_ms ()
103  { return rapid1_timer_usecs () / 1000; }
104 
105  static guint64 rapid2_timer_ms ()
106  { return rapid2_timer_usecs () / 1000; }
107 
108  static guint64 test_length_ms ()
109  { return 2 * 1000; }
110 
111  std::string m_current_test_name;
112 
115 
118 
123 
128 
129  static gboolean _second_timeout_handler (void*);
130  static gboolean _fast_timeout_handler (void*);
131  static gboolean _rapid1_timeout_handler (void*);
132  static gboolean _rapid2_timeout_handler (void*);
133 
134  void start_timing ();
135  void reset_timing ();
136 
138 
139  static void
140  simulate_load (const std::string& name, guint64 time_usecs);
141  Glib::RefPtr<Glib::MainLoop> m_main;
142  Glib::RefPtr<Glib::MainContext> m_context;
143 
146 
152 };
bool on_fast_timeout_glibmm()
void testTimersIdleFrequency()
static guint64 rapid1_timer_ms()
Definition: timer_test.h:102
void testGlibmmSignalTimeouts()
static guint64 fast_timer_usecs()
Definition: timer_test.h:87
CPPUNIT_TEST(testTimers)
void connect_quit_timeout()
CPPUNIT_TEST(testGlibTimeoutSources)
void testGlibTimeoutSources()
void reset_timing_run_main()
bool on_rapid1_timeout_glibmm()
static void simulate_load(const std::string &name, guint64 time_usecs)
CPPUNIT_TEST_SUITE(TimerTest)
static gboolean _fast_timeout_handler(void *)
void _testTimersBlockIdle()
void _testGlibmmTimeoutSources()
void start_timing()
void connect_idle_handler()
CPPUNIT_TEST(testGlibmmTimeoutSources)
static guint64 second_timer_usecs()
Definition: timer_test.h:84
CPPUNIT_TEST(testGlibmmSignalTimeouts)
static guint64 fast_timer_ms()
Definition: timer_test.h:99
CPPUNIT_TEST_SUITE_END()
PBD::TimingData m_second_timing_data
Definition: timer_test.h:148
std::string m_current_test_name
Definition: timer_test.h:111
bool on_rapid2_timeout_glibmm()
bool on_idle_handler()
bool on_quit_handler()
Glib::RefPtr< Glib::MainLoop > m_main
Definition: timer_test.h:141
static guint64 rapid2_timer_ms()
Definition: timer_test.h:105
bool on_second_timeout_glibmm()
bool m_block_idle
Definition: timer_test.h:114
void on_rapid2_timeout()
void _testGlibmmSignalTimeouts()
static guint64 test_length_ms()
Definition: timer_test.h:108
void testTimers()
static gboolean _second_timeout_handler(void *)
void _testGlibTimeoutSources()
PBD::TimingData m_rapid2_timing_data
Definition: timer_test.h:151
void on_fast_timeout()
PBD::TimingData m_idle_timing_data
Definition: timer_test.h:147
static guint64 rapid1_timer_usecs()
Definition: timer_test.h:90
bool m_connect_idle
Definition: timer_test.h:113
void _testTimersIdleFrequency()
CPPUNIT_TEST(testTimersIdleFrequency)
void on_second_timeout()
static gboolean _rapid1_timeout_handler(void *)
void testTimersBlockIdle()
void _testTimers()
void reset_timing()
static guint64 second_timer_ms()
Definition: timer_test.h:96
Glib::RefPtr< Glib::MainContext > m_context
Definition: timer_test.h:142
CPPUNIT_TEST(testTimersBlockIdle)
void on_rapid1_timeout()
PBD::TimingData m_rapid1_timing_data
Definition: timer_test.h:150
void testGlibmmTimeoutSources()
static guint64 rapid2_timer_usecs()
Definition: timer_test.h:93
static gboolean _rapid2_timeout_handler(void *)
PBD::TimingData m_fast_timing_data
Definition: timer_test.h:149
GtkImageIconNameData name
Definition: gtkimage.h:6