1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2011. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #ifdef HAVE_CONFIG_H |
---|
13 | #include "config.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | #include <timesys.h> |
---|
17 | #include <rtems/timerdrv.h> |
---|
18 | #include "test_support.h" |
---|
19 | |
---|
20 | #include <pthread.h> |
---|
21 | |
---|
22 | void *Low( |
---|
23 | void *argument |
---|
24 | ) |
---|
25 | { |
---|
26 | long end_time; |
---|
27 | |
---|
28 | end_time = benchmark_timer_read(); |
---|
29 | |
---|
30 | put_time( |
---|
31 | "sleep - blocking", |
---|
32 | end_time, |
---|
33 | OPERATION_COUNT, |
---|
34 | 0, |
---|
35 | 0 |
---|
36 | ); |
---|
37 | |
---|
38 | puts( "*** END OF POSIX TIME TEST sleep - blocking ***" ); |
---|
39 | |
---|
40 | rtems_test_exit( 0 ); |
---|
41 | return NULL; |
---|
42 | } |
---|
43 | |
---|
44 | void *Middle( |
---|
45 | void *argument |
---|
46 | ) |
---|
47 | { |
---|
48 | sleep(1); |
---|
49 | return NULL; |
---|
50 | } |
---|
51 | |
---|
52 | void *POSIX_Init( |
---|
53 | void *argument |
---|
54 | ) |
---|
55 | { |
---|
56 | int i; |
---|
57 | int status; |
---|
58 | pthread_t threadId; |
---|
59 | |
---|
60 | puts( "\n\n*** POSIX TIME TEST sleep - blocking ***" ); |
---|
61 | |
---|
62 | for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) { |
---|
63 | status = pthread_create( &threadId, NULL, Middle, NULL ); |
---|
64 | rtems_test_assert( !status ); |
---|
65 | } |
---|
66 | |
---|
67 | status = pthread_create( &threadId, NULL, Low, NULL ); |
---|
68 | rtems_test_assert( !status ); |
---|
69 | |
---|
70 | /* start the timer and switch through all the other tasks */ |
---|
71 | benchmark_timer_initialize(); |
---|
72 | sleep(1); |
---|
73 | return NULL; |
---|
74 | } |
---|
75 | |
---|
76 | /* configuration information */ |
---|
77 | |
---|
78 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
79 | #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER |
---|
80 | |
---|
81 | #define CONFIGURE_MAXIMUM_POSIX_THREADS OPERATION_COUNT + 2 |
---|
82 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
83 | |
---|
84 | #define CONFIGURE_INIT |
---|
85 | |
---|
86 | #include <rtems/confdefs.h> |
---|
87 | /* end of file */ |
---|