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

Last change on this file was d62f299, checked in by Sebastian Huber <sebastian.huber@…>, on 03/20/24 at 07:12:38

Do not define CONFIGURE_TICKS_PER_TIMESLICE to 0

Unconditionally make a CONFIGURE_TICKS_PER_TIMESLICE value less than or equal
to zero an error.

Update #4986.

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