source: rtems/testsuites/rhealstone/rhilatency/ilatency.c @ b6c1578

4.11
Last change on this file since b6c1578 was b6c1578, checked in by Joel Sherrill <joel.sherrill@…>, on Jan 5, 2014 at 5:17:08 PM

rhealstone: Add rh prefix to all test names

This makes them easier to spot as a group in wildcard searches.

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/* Copyright 2014 Daniel Ramirez (javamonn@gmail.com)
2 *
3 * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file.
4 */
5
6/*
7 *  WARNING!!!!!!!!!
8 *
9 *  THIS TEST USES INTERNAL RTEMS VARIABLES!!!
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#define CONFIGURE_INIT
17#include <timesys.h>
18#include <rtems/timerdrv.h>
19#include <coverhd.h>
20
21/* configuration information */
22#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
23#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
24#define CONFIGURE_MAXIMUM_TASKS              2
25#define CONFIGURE_TICKS_PER_TIMESLICE        0
26#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
27#define CONFIGURE_SCHEDULER_PRIORITY
28
29#include <rtems/confdefs.h>
30
31#include <bsp.h>
32
33#define _RTEMS_TMTEST27
34#include <tm27.h>
35
36#define BENCHMARKS 50000
37
38rtems_task Task_1(
39  rtems_task_argument argument
40);
41
42uint32_t   Interrupt_nest;
43uint32_t   timer_overhead;
44uint32_t   Interrupt_enter_time;
45
46rtems_isr Isr_handler(
47  rtems_vector_number vector
48);
49
50rtems_task Init(
51  rtems_task_argument argument
52)
53{
54  rtems_status_code status;
55  rtems_id Task_id;
56
57  Print_Warning();
58
59  if (_Scheduler.Operations.initialize != _Scheduler_priority_Initialize) {
60    puts( "  Error ==> " );
61    puts( "Test only supported for deterministic priority scheduler\n" );
62    rtems_test_exit( 0 );
63  }
64
65#define LOW_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1u)
66  status = rtems_task_create(
67    rtems_build_name( 'T', 'A', '1', ' ' ),
68    LOW_PRIORITY,
69    RTEMS_MINIMUM_STACK_SIZE,
70    RTEMS_DEFAULT_MODES,
71    RTEMS_DEFAULT_ATTRIBUTES,
72    &Task_id
73  );
74  directive_failed( status, "rtems_task_create Task_1" );
75
76  status = rtems_task_start( Task_id, Task_1, 0 );
77  directive_failed( status, "rtems_task_start Task_1" );
78
79  benchmark_timer_initialize();
80  benchmark_timer_read();
81  benchmark_timer_initialize();
82  timer_overhead = benchmark_timer_read();
83
84  status = rtems_task_delete( RTEMS_SELF );
85  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
86}
87
88rtems_task Task_1(
89  rtems_task_argument argument
90)
91{
92  Install_tm27_vector( Isr_handler ) ;
93  Interrupt_nest = 0;
94  _Thread_Dispatch_set_disable_level( 0 );
95
96  /* Benchmark code */
97  benchmark_timer_initialize();
98  /* goes to Isr_handler */
99  Cause_tm27_intr();
100
101  put_time(
102    "Rhealstone: Interrupt Latency",
103    Interrupt_enter_time,
104    1,                             /* Only Rhealstone that isn't an average */
105    timer_overhead,
106    0
107  );
108
109  rtems_test_exit( 0 );
110}
111
112rtems_isr Isr_handler(
113  rtems_vector_number vector
114)
115{
116  /* See how long it took system to recognize interrupt */
117  Interrupt_enter_time = benchmark_timer_read();
118  Clear_tm27_intr();
119}
Note: See TracBrowser for help on using the repository browser.