YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
void test_cycle()
{
ulonglong t1= my_timer_cycles();
ulonglong t2; int i; int backward= 0; int nonzero= 0;
for (i=0 ; i < LOOP_COUNT ; i++)
{
t2= my_timer_cycles(); if (t1 >= t2)
backward++; if (t2 != 0)
nonzero++;
t1= t2;
}
/* Expect at most 1 backward, the cycle value can overflow */
ok((backward <= 1), "The cycle timer is strictly increasing");
if (myt.cycles.routine != 0)
ok((nonzero != 0), "The cycle timer is implemented"); else
ok((nonzero == 0), "The cycle timer is not implemented and returns 0");
}
void test_nanosecond()
{
ulonglong t1= my_timer_nanoseconds();
ulonglong t2; int i; int backward= 0; int nonzero= 0;
for (i=0 ; i < LOOP_COUNT ; i++)
{
t2= my_timer_nanoseconds(); if (t1 > t2)
backward++; if (t2 != 0)
nonzero++;
t1= t2;
}
ok((backward == 0), "The nanosecond timer is increasing");
if (myt.nanoseconds.routine != 0)
ok((nonzero != 0), "The nanosecond timer is implemented"); else
ok((nonzero == 0), "The nanosecond timer is not implemented and returns 0");
}
void test_microsecond()
{
ulonglong t1= my_timer_microseconds();
ulonglong t2; int i; int backward= 0; int nonzero= 0;
for (i=0 ; i < LOOP_COUNT ; i++)
{
t2= my_timer_microseconds(); if (t1 > t2)
backward++; if (t2 != 0)
nonzero++;
t1= t2;
}
ok((backward == 0), "The microsecond timer is increasing");
if (myt.microseconds.routine != 0)
ok((nonzero != 0), "The microsecond timer is implemented"); else
ok((nonzero == 0), "The microsecond timer is not implemented and returns 0");
}
void test_millisecond()
{
ulonglong t1= my_timer_milliseconds();
ulonglong t2; int i; int backward= 0; int nonzero= 0;
for (i=0 ; i < LOOP_COUNT ; i++)
{
t2= my_timer_milliseconds(); if (t1 > t2)
backward++; if (t2 != 0)
nonzero++;
t1= t2;
}
ok((backward == 0), "The millisecond timer is increasing");
if (myt.milliseconds.routine != 0)
ok((nonzero != 0), "The millisecond timer is implemented"); else
ok((nonzero == 0), "The millisecond timer is not implemented and returns 0");
}
void test_tick()
{
ulonglong t1= my_timer_ticks();
ulonglong t2; int i; int backward= 0; int nonzero= 0;
for (i=0 ; i < LOOP_COUNT ; i++)
{
t2= my_timer_ticks(); if (t1 > t2)
backward++; if (t2 != 0)
nonzero++;
t1= t2;
}
ok((backward == 0), "The tick timer is increasing");
if (myt.ticks.routine != 0)
ok((nonzero != 0), "The tick timer is implemented"); else
ok((nonzero == 0), "The tick timer is not implemented and returns 0");
}
int main(int argc __attribute__((unused)), char ** argv __attribute__((unused)))
{
plan(11);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.21Bemerkung:
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.