source: rtems/testsuites/psxtmtests/psxtmonce01/init.c @ 98cc00e6

5
Last change on this file since 98cc00e6 was 98cc00e6, checked in by Joel Sherrill <joel@…>, on 11/07/18 at 18:07:53

psxtmonce01/init.c: Use static and Simple Console

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  COPYRIGHT (c) 2018.
3 *  Himanshu Sekhar Nayak GCI 2018
4 *
5 *  Permission to use, copy, modify, and/or distribute this software
6 *  for any purpose with or without fee is hereby granted.
7 *
8 *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
9 *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
10 *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
11 *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
12 *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
13 *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
14 *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifdef HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <pthread.h>
22#include <tmacros.h>
23#include <timesys.h>
24#include <rtems/btimer.h>
25#include "test_support.h"
26
27const char rtems_test_name[] = "PSXTMONCE01";
28
29static pthread_once_t once_control = PTHREAD_ONCE_INIT;
30
31static void initRoutine(void)
32{
33}
34
35static void benchmark_first_time(void)
36{
37  long end_time;
38  int  status;
39
40  benchmark_timer_initialize();
41  status = pthread_once( &once_control, initRoutine );
42  end_time = benchmark_timer_read();
43  rtems_test_assert( status == 0 );
44
45  put_time(
46    "pthread_once: first time",
47    end_time,
48    1,        /* Only executed once */
49    0,
50    0
51  );
52}
53
54static void *POSIX_Init(
55  void *argument
56)
57{
58
59  TEST_BEGIN();
60  benchmark_first_time();
61  TEST_END();
62
63  rtems_test_exit(0);
64}
65
66/* configuration information */
67
68#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
69#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
70
71#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
72#define CONFIGURE_POSIX_INIT_THREAD_TABLE
73
74#define CONFIGURE_INIT
75
76#include <rtems/confdefs.h>
77/* end of file */
Note: See TracBrowser for help on using the repository browser.