+static clib_error_t *
+test1_two_timer_double (tw_timer_test_main_t * tm)
+{
+ u32 i;
+ tw_timer_test_elt_t *e;
+ u32 offset;
+
+ tw_timer_wheel_init_2t_2w_512sl (&tm->two_timer_double_wheel,
+ expired_timer_two_timer_double_callback,
+ 1.0 /* timer interval */ , ~0);
+
+ /*
+ * Prime offset, to make sure that the wheel starts in a
+ * non-trivial position
+ */
+ offset = 2745;
+
+ run_two_timer_double_wheel (&tm->two_timer_double_wheel, offset);
+
+ fformat (stdout, "initial wheel time %d, fast index %d\n",
+ tm->two_timer_double_wheel.current_tick,
+ tm->two_timer_double_wheel.current_index[TW_TIMER_RING_FAST]);
+
+ for (i = 0; i < tm->ntimers; i++)
+ {
+ pool_get (tm->test_elts, e);
+ clib_memset (e, 0, sizeof (*e));
+
+ e->expected_to_expire = i + tm->two_timer_double_wheel.current_tick + 1;
+ e->stop_timer_handle = tw_timer_start_2t_2w_512sl
+ (&tm->two_timer_double_wheel, e - tm->test_elts, 1 /* timer id */ ,
+ i + 1);
+ }
+ run_two_timer_double_wheel (&tm->two_timer_double_wheel, tm->ntimers + 3);
+
+ if (pool_elts (tm->test_elts))
+ fformat (stdout, "Note: %d elements remain in pool\n",
+ pool_elts (tm->test_elts));
+
+ /* *INDENT-OFF* */
+ pool_foreach (e, tm->test_elts,
+ ({
+ fformat(stdout, "[%d] expected to expire %d\n",
+ e - tm->test_elts,
+ e->expected_to_expire);
+ }));
+ /* *INDENT-ON* */
+
+ fformat (stdout,
+ "final wheel time %d, fast index %d\n",
+ tm->two_timer_double_wheel.current_tick,
+ tm->two_timer_double_wheel.current_index[TW_TIMER_RING_FAST]);
+
+ pool_free (tm->test_elts);
+ tw_timer_wheel_free_2t_2w_512sl (&tm->two_timer_double_wheel);
+ return 0;
+}
+