summaryrefslogtreecommitdiffstats
path: root/testsuites/rhealstone/rhilatency
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-01-05 11:17:08 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-01-05 11:17:08 -0600
commitb6c1578bb91fb54c826141e0f8bbd9cb2009f3cf (patch)
tree6d4c9af3892de78428add886865bae7db15efbc1 /testsuites/rhealstone/rhilatency
parentrhealstone/*.c: Add Print_Warning() call to indicate debug enabled (diff)
downloadrtems-b6c1578bb91fb54c826141e0f8bbd9cb2009f3cf.tar.bz2
rhealstone: Add rh prefix to all test names
This makes them easier to spot as a group in wildcard searches.
Diffstat (limited to 'testsuites/rhealstone/rhilatency')
-rw-r--r--testsuites/rhealstone/rhilatency/Makefile.am23
-rw-r--r--testsuites/rhealstone/rhilatency/ilatency.c119
-rw-r--r--testsuites/rhealstone/rhilatency/rhilatency.adoc21
3 files changed, 163 insertions, 0 deletions
diff --git a/testsuites/rhealstone/rhilatency/Makefile.am b/testsuites/rhealstone/rhilatency/Makefile.am
new file mode 100644
index 0000000000..faaf10f571
--- /dev/null
+++ b/testsuites/rhealstone/rhilatency/Makefile.am
@@ -0,0 +1,23 @@
+MANAGERS = all
+
+rtems_tests_PROGRAMS = rhilatency
+rhilatency_SOURCES = ilatency.c
+rhilatency_SOURCES += ../../tmtests/include/timesys.h
+
+dist_rtems_tests_DATA = rhilatency.adoc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../tmtests/include
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(rhilatency_OBJECTS) $(rhilatency_ldaDD)
+LINK_LIBS = $(rhilatency_LDLIBS)
+
+rhilatency$(EXEEXT): $(rhilatency_OBJECTS) $(rhilatency_DEPENDENCIES)
+ @rm -f rhilatency$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/rhealstone/rhilatency/ilatency.c b/testsuites/rhealstone/rhilatency/ilatency.c
new file mode 100644
index 0000000000..c5a8b0c98d
--- /dev/null
+++ b/testsuites/rhealstone/rhilatency/ilatency.c
@@ -0,0 +1,119 @@
+/* Copyright 2014 Daniel Ramirez (javamonn@gmail.com)
+ *
+ * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file.
+ */
+
+/*
+ * WARNING!!!!!!!!!
+ *
+ * THIS TEST USES INTERNAL RTEMS VARIABLES!!!
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include <timesys.h>
+#include <rtems/timerdrv.h>
+#include <coverhd.h>
+
+/* configuration information */
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_TICKS_PER_TIMESLICE 0
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_SCHEDULER_PRIORITY
+
+#include <rtems/confdefs.h>
+
+#include <bsp.h>
+
+#define _RTEMS_TMTEST27
+#include <tm27.h>
+
+#define BENCHMARKS 50000
+
+rtems_task Task_1(
+ rtems_task_argument argument
+);
+
+uint32_t Interrupt_nest;
+uint32_t timer_overhead;
+uint32_t Interrupt_enter_time;
+
+rtems_isr Isr_handler(
+ rtems_vector_number vector
+);
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id Task_id;
+
+ Print_Warning();
+
+ if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
+ puts( " Error ==> " );
+ puts( "Test only supported for deterministic priority scheduler\n" );
+ rtems_test_exit( 0 );
+ }
+
+#define LOW_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1u)
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '1', ' ' ),
+ LOW_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_id
+ );
+ directive_failed( status, "rtems_task_create Task_1" );
+
+ status = rtems_task_start( Task_id, Task_1, 0 );
+ directive_failed( status, "rtems_task_start Task_1" );
+
+ benchmark_timer_initialize();
+ benchmark_timer_read();
+ benchmark_timer_initialize();
+ timer_overhead = benchmark_timer_read();
+
+ status = rtems_task_delete( RTEMS_SELF );
+ directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
+rtems_task Task_1(
+ rtems_task_argument argument
+)
+{
+ Install_tm27_vector( Isr_handler ) ;
+ Interrupt_nest = 0;
+ _Thread_Dispatch_set_disable_level( 0 );
+
+ /* Benchmark code */
+ benchmark_timer_initialize();
+ /* goes to Isr_handler */
+ Cause_tm27_intr();
+
+ put_time(
+ "Rhealstone: Interrupt Latency",
+ Interrupt_enter_time,
+ 1, /* Only Rhealstone that isn't an average */
+ timer_overhead,
+ 0
+ );
+
+ rtems_test_exit( 0 );
+}
+
+rtems_isr Isr_handler(
+ rtems_vector_number vector
+)
+{
+ /* See how long it took system to recognize interrupt */
+ Interrupt_enter_time = benchmark_timer_read();
+ Clear_tm27_intr();
+}
diff --git a/testsuites/rhealstone/rhilatency/rhilatency.adoc b/testsuites/rhealstone/rhilatency/rhilatency.adoc
new file mode 100644
index 0000000000..2f8a980142
--- /dev/null
+++ b/testsuites/rhealstone/rhilatency/rhilatency.adoc
@@ -0,0 +1,21 @@
+= Interrupt Latency Benchmark
+
+This benchmark measures the time between the CPU's receipt of an interrupt
+request and the execution of the first intruction in that interrupt service
+routine.
+
+== Directives
+
+ * Intall_tm27_vector
+ * Cause_tm27_intr
+
+
+== Methodology
+
+This benchmark takes advantage of the existing tm27 test support implemented
+by most BSP's to achieve as much hardware independence as possible. Most BSPs
+have an instruction to install an interrupt vector, and then provide code for
+the ISR. rtems/testsuites/tmtests/tm27 uses this to test a variety of interrupt
+related concepts. The benchmark is simple, the vector is installed, the time
+is started, the interrupt is caused, and the time is ended in the first
+instruction of the ISR. This is the only Rhealstone that is not an average.