Пример #1
0
/** Wait several microseconds.
 *
 * We assume that interrupts are already disabled.
 *
 * @param t Microseconds to wait.
 */
void asm_delay_loop(const uint32_t usec)
{
	uint64_t stop = tick_read() + (uint64_t) usec * (uint64_t)
	    CPU->arch.clock_frequency / 1000000;

	while (tick_read() < stop)
		;
}
Пример #2
0
static void* slave_entry(void* foo)
{
  make_preemptpoint(&global_pp);
  pthread_barrier_wait(&global_barrier);

  global_iter = 0;

  while (1)
  {
    /* do some processing */

    tick_counter_t start, stop;

    tick_read(&start);
    test_preemptpoint(&global_pp);
    tick_read(&stop);

    global_ticks += stop.value - start.value;

    ++global_iter;
  }

  return NULL;
}
Пример #3
0
static void mult_switch(unsigned int n, gsl_matrix* res, gsl_matrix* lhs, gsl_matrix* rhs)
{
  void (*f)(gsl_matrix*, gsl_matrix*, gsl_matrix*) = NULL;

#if CONFIG_USE_TICK
  tick_counter_t ticks[3];
#endif

#define CASE_TO_F(__f, __n) case __n: __f = mult_matrix ## __n; break
  switch (n)
  {
    CASE_TO_F(f, 0);
    CASE_TO_F(f, 1);
    CASE_TO_F(f, 2);
  }

  gsl_matrix_set_zero(res);

#if CONFIG_USE_TICK
  tick_read(&ticks[0]);
#endif

  f(res, lhs, rhs);

#if CONFIG_USE_TICK
  tick_read(&ticks[1]);
#endif

#if CONFIG_USE_TICK
  tick_sub(&ticks[2], &ticks[1], &ticks[0]);
  printf("ticks: %llu\n", ticks[2].value);
#endif

  print_matrix(res);
  printf("---\n");
}