示例#1
0
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");
}
示例#2
0
void chassis_timestamp_init_now(chassis_timestamp_t *ts,
        const char *name,
        const char *filename,
        gint line) {

    ts->name = name;
    ts->filename = filename;
    ts->line = line;
    ts->usec = my_timer_microseconds();
    ts->cycles = my_timer_cycles();
    ts->ticks = my_timer_ticks();
}