source: rtems/testsuites/psxtmtests/psxtmkey01/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.8 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 <errno.h>
17#include <pthread.h>
18#include "test_support.h"
19
20/* forward declarations to avoid warnings */
21void *POSIX_Init(void *argument);
22
23pthread_key_t Key;
24
25static void benchmark_pthread_key_create(void)
26{
27  benchmark_timer_t end_time;
28  int  status;
29
30  benchmark_timer_initialize();
31    status = pthread_key_create(&Key, NULL);
32  end_time = benchmark_timer_read();
33  rtems_test_assert( status == 0 );
34
35  put_time(
36    "pthread_key_create: only case",
37    end_time,
38    1,        /* Only executed once */
39    0,
40    0
41  );
42
43}
44
45static void benchmark_pthread_key_delete(void)
46{
47  benchmark_timer_t end_time;
48  int  status;
49
50  benchmark_timer_initialize();
51    status = pthread_key_delete(Key);
52  end_time = benchmark_timer_read();
53  rtems_test_assert( status == 0 );
54
55  put_time(
56    "pthread_key_delete: only case",
57    end_time,
58    1,        /* Only executed once */
59    0,
60    0
61  );
62
63}
64
65void *POSIX_Init(void *argument)
66{
67
68  puts( "\n\n*** POSIX TIME TEST PSXTMKEY01 ***" );
69
70  /*key creation, using NULL destructor*/
71  benchmark_pthread_key_create();
72 
73  /* key deletion*/
74  benchmark_pthread_key_delete();
75 
76  puts( "*** END OF POSIX TIME TEST PSXTMKEY01 ***" );
77
78  rtems_test_exit(0);
79}
80
81/* configuration information */
82
83#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
84#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
85
86#define CONFIGURE_MAXIMUM_POSIX_THREADS     2
87#define CONFIGURE_MAXIMUM_POSIX_KEYS     1
88#define CONFIGURE_POSIX_INIT_THREAD_TABLE
89
90#define CONFIGURE_INIT
91
92#include <rtems/confdefs.h>
93/* end of file */
Note: See TracBrowser for help on using the repository browser.