source: rtems/testsuites/psxtmtests/psxtmsleep02/init.c @ 50162e0

4.115
Last change on this file since 50162e0 was 50162e0, checked in by Joel Sherrill <joel.sherrill@…>, on 12/07/13 at 18:18:02

psxtmtests: Make output more uniform

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2013.
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
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <timesys.h>
15#include <rtems/timerdrv.h>
16#include "test_support.h"
17
18#include <pthread.h>
19
20/* forward declarations to avoid warnings */
21void *POSIX_Init(void *argument);
22void *Middle(void *argument);
23void *Low(void *argument);
24
25void *Low(
26  void *argument
27)
28{
29  benchmark_timer_t end_time;
30
31  end_time = benchmark_timer_read();
32
33  put_time(
34    "sleep: blocking",
35    end_time,
36    OPERATION_COUNT,
37    0,
38    0
39  );
40
41  puts( "*** END OF POSIX TIME TEST PSXTMSLEEP02 ***" );
42
43  rtems_test_exit( 0 );
44  return NULL;
45}
46
47void *Middle(
48  void *argument
49)
50{
51  sleep(1);
52  return NULL;
53}
54
55void *POSIX_Init(
56  void *argument
57)
58{
59  int        i;
60  int        status;
61  pthread_t  threadId;
62
63  puts( "\n\n*** POSIX TIME TEST PSXTMSLEEP02 ***" );
64
65  for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) {
66    status = pthread_create( &threadId, NULL, Middle, NULL );
67    rtems_test_assert( !status );
68  }
69 
70  status = pthread_create( &threadId, NULL, Low, NULL );
71  rtems_test_assert( !status );
72
73  /* start the timer and switch through all the other tasks */
74  benchmark_timer_initialize();
75  sleep(1);
76  return NULL;
77}
78
79/* configuration information */
80
81#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
82#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
83
84#define CONFIGURE_MAXIMUM_POSIX_THREADS     OPERATION_COUNT + 2
85#define CONFIGURE_POSIX_INIT_THREAD_TABLE
86
87#define CONFIGURE_INIT
88
89#include <rtems/confdefs.h>
90  /* end of file */
Note: See TracBrowser for help on using the repository browser.