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

5
Last change on this file since e58e29fd was e58e29fd, checked in by Sebastian Huber <sebastian.huber@…>, on 11/24/17 at 06:58:55

Remove coverhd.h

This header file contained timing overhead values which are hard to
maintain.

Update #3254.

  • Property mode set to 100644
File size: 2.7 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/btimer.h>
19#include <rtems/score/schedulerpriorityimpl.h>
20
21/* configuration information */
22#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_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
36const char rtems_test_name[] = "RHILATENCY";
37
38#define BENCHMARKS 50000
39
40rtems_task Task_1(
41  rtems_task_argument argument
42);
43
44uint32_t   Interrupt_nest;
45uint32_t   timer_overhead;
46uint32_t   Interrupt_enter_time;
47
48rtems_isr Isr_handler(
49  rtems_vector_number vector
50);
51
52rtems_task Init(
53  rtems_task_argument argument
54)
55{
56  rtems_status_code status;
57  rtems_id Task_id;
58
59  Print_Warning();
60
61  TEST_BEGIN();
62
63  if (
64    _Scheduler_Table[ 0 ].Operations.initialize
65      != _Scheduler_priority_Initialize
66  ) {
67    puts( "  Error ==> " );
68    puts( "Test only supported for deterministic priority scheduler\n" );
69    rtems_test_exit( 0 );
70  }
71
72#define LOW_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1u)
73  status = rtems_task_create(
74    rtems_build_name( 'T', 'A', '1', ' ' ),
75    LOW_PRIORITY,
76    RTEMS_MINIMUM_STACK_SIZE,
77    RTEMS_DEFAULT_MODES,
78    RTEMS_DEFAULT_ATTRIBUTES,
79    &Task_id
80  );
81  directive_failed( status, "rtems_task_create Task_1" );
82
83  status = rtems_task_start( Task_id, Task_1, 0 );
84  directive_failed( status, "rtems_task_start Task_1" );
85
86  benchmark_timer_initialize();
87  benchmark_timer_read();
88  benchmark_timer_initialize();
89  timer_overhead = benchmark_timer_read();
90
91  status = rtems_task_delete( RTEMS_SELF );
92  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
93}
94
95rtems_task Task_1(
96  rtems_task_argument argument
97)
98{
99  Install_tm27_vector( Isr_handler ) ;
100  Interrupt_nest = 0;
101
102  /* Benchmark code */
103  benchmark_timer_initialize();
104  /* goes to Isr_handler */
105  Cause_tm27_intr();
106
107  put_time(
108    "Rhealstone: Interrupt Latency",
109    Interrupt_enter_time,
110    1,                             /* Only Rhealstone that isn't an average */
111    timer_overhead,
112    0
113  );
114
115  TEST_END();
116  rtems_test_exit( 0 );
117}
118
119rtems_isr Isr_handler(
120  rtems_vector_number vector
121)
122{
123  /* See how long it took system to recognize interrupt */
124  Interrupt_enter_time = benchmark_timer_read();
125  Clear_tm27_intr();
126}
Note: See TracBrowser for help on using the repository browser.