Intel® OpenMP* Runtime Library
ompt-internal.h
1 /*
2  * ompt-internal.h -- OMPT internal header file.
3  */
4 
5 /* <copyright>
6  Copyright (c) 1997-2015 Intel Corporation. All Rights Reserved.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions
10  are met:
11 
12  * Redistributions of source code must retain the above copyright
13  notice, this list of conditions and the following disclaimer.
14  * Redistributions in binary form must reproduce the above copyright
15  notice, this list of conditions and the following disclaimer in the
16  documentation and/or other materials provided with the distribution.
17  * Neither the name of Intel Corporation nor the names of its
18  contributors may be used to endorse or promote products derived
19  from this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 </copyright> */
34 
35 #ifndef __OMPT_INTERNAL_H__
36 #define __OMPT_INTERNAL_H__
37 
38 #include "ompt.h"
39 #include "ompt-event-specific.h"
40 
41 #define OMPT_VERSION 1
42 
43 #define _OMP_EXTERN extern "C"
44 
45 
46 
47 #define ompt_callback(e) e ## _callback
48 
49 /* track and track_callback share a bit so that one can test whether either is
50  * set by anding a bit.
51  */
52 typedef enum {
53  ompt_status_disabled = 0x0,
54  ompt_status_ready = 0x1,
55  ompt_status_track = 0x2,
56  ompt_status_track_callback = 0x6,
57 } ompt_status_t;
58 
59 
60 typedef struct ompt_callbacks_s {
61 #define ompt_event_macro(event, callback, eventid) callback ompt_callback(event);
62 
63  FOREACH_OMPT_EVENT(ompt_event_macro)
64 
65 #undef ompt_event_macro
66 } ompt_callbacks_t;
67 
68 
69 
70 typedef struct {
71  ompt_frame_t frame;
72  void* function;
73  ompt_task_id_t task_id;
74 } ompt_task_info_t;
75 
76 
77 typedef struct {
78  ompt_parallel_id_t parallel_id;
79  void *microtask;
80 } ompt_team_info_t;
81 
82 
83 typedef struct ompt_lw_taskteam_s {
84  ompt_team_info_t ompt_team_info;
85  ompt_task_info_t ompt_task_info;
86  struct ompt_lw_taskteam_s *parent;
87 } ompt_lw_taskteam_t;
88 
89 
90 typedef struct ompt_parallel_info_s {
91  ompt_task_id_t parent_task_id; /* id of parent task */
92  ompt_parallel_id_t parallel_id; /* id of parallel region */
93  ompt_frame_t *parent_task_frame; /* frame data of parent task */
94  void *parallel_function; /* pointer to outlined function */
95 } ompt_parallel_info_t;
96 
97 
98 typedef struct {
99  ompt_state_t state;
100  ompt_wait_id_t wait_id;
101  void *idle_frame;
102 } ompt_thread_info_t;
103 
104 
105 extern ompt_status_t ompt_status;
106 extern ompt_callbacks_t ompt_callbacks;
107 
108 #ifdef __cplusplus
109 extern "C" {
110 #endif
111 
112 void ompt_init(void);
113 void ompt_fini(void);
114 
115 #ifdef __cplusplus
116 };
117 #endif
118 
119 #endif