Esempio n. 1
0
static void test_by_function_level(int fl, bool dirty)
{
  rtems_interrupt_lock lock;
  rtems_interrupt_lock_context lock_context;
  int s;
  uint64_t min;
  uint64_t q1;
  uint64_t q2;
  uint64_t q3;
  uint64_t max;

  rtems_interrupt_lock_initialize(&lock, "test");
  rtems_interrupt_lock_acquire(&lock, &lock_context);

  for (s = 0; s < SAMPLES; ++s) {
    call_at_level(fl, fl, s, dirty);
  }

  rtems_interrupt_lock_release(&lock, &lock_context);
  rtems_interrupt_lock_destroy(&lock);

  sort_t();

  min = t[0];
  q1 = t[(1 * SAMPLES) / 4];
  q2 = t[SAMPLES / 2];
  q3 = t[(3 * SAMPLES) / 4];
  max = t[SAMPLES - 1];

  printf(
    "    <Sample functionNestLevel=\"%i\">\n"
    "      <Min unit=\"ns\">%" PRIu64 "</Min>"
      "<Q1 unit=\"ns\">%" PRIu64 "</Q1>"
      "<Q2 unit=\"ns\">%" PRIu64 "</Q2>"
      "<Q3 unit=\"ns\">%" PRIu64 "</Q3>"
      "<Max unit=\"ns\">%" PRIu64 "</Max>\n"
    "    </Sample>\n",
    fl,
    rtems_counter_ticks_to_nanoseconds(min),
    rtems_counter_ticks_to_nanoseconds(q1),
    rtems_counter_ticks_to_nanoseconds(q2),
    rtems_counter_ticks_to_nanoseconds(q3),
    rtems_counter_ticks_to_nanoseconds(max)
  );
}
Esempio n. 2
0
File: init.c Progetto: gedare/rtems
static void test_converter(void)
{
  CPU_Counter_ticks frequency = rtems_counter_nanoseconds_to_ticks(1000000000);
  uint64_t ns = rtems_counter_ticks_to_nanoseconds(frequency);

  printf("CPU counter frequency: %" PRIu32 "Hz\n", frequency);
  printf("nanoseconds for frequency count ticks: %" PRIu64 "\n", ns);

  rtems_test_assert(ns == 1000000000);
}
Esempio n. 3
0
File: init.c Progetto: ChOr82/RTEMS
static uint64_t do_some_work(void)
{
  rtems_counter_ticks a;
  rtems_counter_ticks b;
  rtems_counter_ticks d;

  /* This gives 1024 nop instructions */
  a = rtems_counter_read();
  I512();
  I512();
  b = rtems_counter_read();

  d = rtems_counter_difference(b, a);

  return rtems_counter_ticks_to_nanoseconds(d);
}
Esempio n. 4
0
File: init.c Progetto: gedare/rtems
static uint64_t large_delta_to_ns(rtems_counter_ticks d)
{
  uint64_t ns;

  ns = rtems_counter_ticks_to_nanoseconds(d);

  /* Special case for CPU counters using the clock driver counter */
  if (ns < rtems_configuration_get_nanoseconds_per_tick()) {
    printf(
      "warning: the RTEMS counter seems to be unable to\n"
      "  measure intervals greater than the clock tick interval\n"
    );

    ns += rtems_configuration_get_nanoseconds_per_tick();
  }

  return ns;
}
Esempio n. 5
0
File: init.c Progetto: ChOr82/RTEMS
static uint64_t store(void)
{
  rtems_counter_ticks a;
  rtems_counter_ticks b;
  rtems_counter_ticks d;
  size_t i;
  volatile int *vdata = &data[0];

  a = rtems_counter_read();
  for (i = 0; i < RTEMS_ARRAY_SIZE(data); ++i) {
    vdata[i] = 0;
  }
  b = rtems_counter_read();

  d = rtems_counter_difference(b, a);

  return rtems_counter_ticks_to_nanoseconds(d);
}
Esempio n. 6
0
File: init.c Progetto: gedare/rtems
static void report_overhead(
  const char *name,
  rtems_counter_ticks t1,
  rtems_counter_ticks t0
)
{
  rtems_counter_ticks d;
  uint64_t ns;

  d = rtems_counter_difference(t1, t0);
  ns = rtems_counter_ticks_to_nanoseconds(d);

  printf(
    "overhead %s: %" PRIu64 " ticks, %" PRIu64 "ns\n",
    name,
    (uint64_t) d,
    ns
  );
}