HPCToolkit
lushi.h
Go to the documentation of this file.
1 // -*-Mode: C++;-*- // technically C99
2 
3 // * BeginRiceCopyright *****************************************************
4 //
5 // $HeadURL$
6 // $Id$
7 //
8 // --------------------------------------------------------------------------
9 // Part of HPCToolkit (hpctoolkit.org)
10 //
11 // Information about sources of support for research and development of
12 // HPCToolkit is at 'hpctoolkit.org' and in 'README.Acknowledgments'.
13 // --------------------------------------------------------------------------
14 //
15 // Copyright ((c)) 2002-2019, Rice University
16 // All rights reserved.
17 //
18 // Redistribution and use in source and binary forms, with or without
19 // modification, are permitted provided that the following conditions are
20 // met:
21 //
22 // * Redistributions of source code must retain the above copyright
23 // notice, this list of conditions and the following disclaimer.
24 //
25 // * Redistributions in binary form must reproduce the above copyright
26 // notice, this list of conditions and the following disclaimer in the
27 // documentation and/or other materials provided with the distribution.
28 //
29 // * Neither the name of Rice University (RICE) nor the names of its
30 // contributors may be used to endorse or promote products derived from
31 // this software without specific prior written permission.
32 //
33 // This software is provided by RICE and contributors "as is" and any
34 // express or implied warranties, including, but not limited to, the
35 // implied warranties of merchantability and fitness for a particular
36 // purpose are disclaimed. In no event shall RICE or contributors be
37 // liable for any direct, indirect, incidental, special, exemplary, or
38 // consequential damages (including, but not limited to, procurement of
39 // substitute goods or services; loss of use, data, or profits; or
40 // business interruption) however caused and on any theory of liability,
41 // whether in contract, strict liability, or tort (including negligence
42 // or otherwise) arising in any way out of the use of this software, even
43 // if advised of the possibility of such damage.
44 //
45 // ******************************************************* EndRiceCopyright *
46 
47 //***************************************************************************
48 //
49 // File:
50 // $HeadURL$
51 //
52 // Purpose:
53 // LUSH Interface: Interface for LUSH agents
54 //
55 // Description:
56 // [The set of functions, macros, etc. defined in the file]
57 //
58 // Author:
59 // Nathan Tallent, Rice University.
60 //
61 //***************************************************************************
62 
63 #ifndef lush_lushi_h
64 #define lush_lushi_h
65 
66 //************************* System Include Files ****************************
67 
68 #include <stdlib.h>
69 #include <stdbool.h>
70 
71 //*************************** User Include Files ****************************
72 
73 #include "lush-support-rt.h"
74 #include "lushi-cb.h"
75 
76 //*************************** Forward Declarations **************************
77 
78 #if defined(__cplusplus)
79 extern "C" {
80 #endif
81 
82 // **************************************************************************
83 // A LUSH agent provides:
84 // 1. Facility for logical unwinding
85 // 2. Facility for maintaining active marker
86 // 3. Runtime concurrency information
87 // **************************************************************************
88 
89 #ifdef __cplusplus
90 extern "C" {
91 #endif
92 
93 
94 // --------------------------------------------------------------------------
95 // Initialization/Finalization
96 // --------------------------------------------------------------------------
97 
98 LUSHI_DECL(int, LUSHI_init, (int argc, char** argv,
99  lush_agentid_t aid,
100  LUSHCB_malloc_fn_t malloc_fn,
101  LUSHCB_free_fn_t free_fn,
102  LUSHCB_step_fn_t step_fn,
103  LUSHCB_loadmap_find_fn_t loadmap_fn));
104 
105 LUSHI_DECL(int, LUSHI_fini, ());
106 
107 LUSHI_DECL(char*, LUSHI_strerror, (int code));
108 
109 
110 // --------------------------------------------------------------------------
111 // Maintaining Responsibility for Code/Frame-space
112 // --------------------------------------------------------------------------
113 
114 LUSHI_DECL(int, LUSHI_reg_dlopen, ());
115 
116 LUSHI_DECL(bool, LUSHI_ismycode, (void* addr));
117 
118 
119 // --------------------------------------------------------------------------
120 // Logical Unwinding
121 // --------------------------------------------------------------------------
122 
123 // Given a lush_cursor, step the cursor to the next (less deeply
124 // nested) bichord. Returns:
125 // LUSH_STEP_CONT: if step was sucessful
126 // LUSH_STEP_ERROR: on account of an error.
127 //
128 // It is assumed that:
129 // - the cursor is initialized with the first p-note of what will be
130 // the current p-chord (IOW, p-note is always valid and part of the
131 // p-projection)
132 // - consequently, LUSH_STEP_END_PROJ is not a valid return value.
133 // - the predicate LUSHI_ismycode(ip) holds, where ip is the physical
134 // IP from the p-chord
135 // - the cursor's agent-id field points to the agent responsible for
136 // the last bichord (or NULL).
138 
139 
140 // Given a lush_cursor, _forcefully_ step the cursor to the next (less
141 // deeply nested) p-note which may also be the next p-chord.
142 // Returns:
143 // LUSH_STEP_CONT: if step was sucessful
144 // LUSH_STEP_END_CHORD: if prev p-note was the end of the p-chord
145 // LUSH_STEP_END_PROJ: if prev p-chord was end of p-projection
146 // LUSH_STEP_ERROR: on account of an error.
148 
149 
150 // Given a lush_cursor, step the cursor to the next (less deeply
151 // nested) l-note of the current l-chord.
152 // Returns:
153 // LUSH_STEP_CONT: if step was sucessful (only possible if not a-to-0)
154 // LUSH_STEP_END_CHORD: if prev l-note was the end of the l-chord
155 // LUSH_STEP_ERROR: on account of an error.
157 
158 
159 // ...
160 LUSHI_DECL(int, LUSHI_set_active_frame_marker, (/*context, callback*/));
161 
162 // --------------------------------------------------------------------------
163 
165 LUSHI_DECL(int, LUSHI_lip_eq, (lush_lip_t* lip));
166 
167 LUSHI_DECL(int, LUSHI_lip_read, ());
168 LUSHI_DECL(int, LUSHI_lip_write, ());
169 
170 
171 // --------------------------------------------------------------------------
172 // Metrics
173 // --------------------------------------------------------------------------
174 
175 LUSHI_DECL(bool, LUSHI_do_metric, (uint64_t incrMetricIn, bool* doMetric, bool* doMetricIdleness, uint64_t* incrMetric, double* incrMetricIdleness));
176 
177 
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 // **************************************************************************
183 
184 #undef LUSHI_DECL
185 
186 #if defined(__cplusplus)
187 } /* extern "C" */
188 #endif
189 
190 #endif /* lush_lushi_h */
lush_step_t LUSHI_step_bichord(lush_cursor_t *cursor)
Definition: agent-cilk.c:206
char * LUSHI_strerror(int code)
Definition: agent-cilk.c:152
int LUSHI_fini()
Definition: agent-cilk.c:145
lush_step_t LUSHI_step_lnote(lush_cursor_t *cursor)
Definition: agent-cilk.c:327
int LUSHI_init(int argc, char **argv, lush_agentid_t aid, LUSHCB_malloc_fn_t malloc_fn, LUSHCB_free_fn_t free_fn, LUSHCB_step_fn_t step_fn, LUSHCB_loadmap_find_fn_t loadmap_fn)
Definition: agent-cilk.c:126
int LUSHI_reg_dlopen()
Definition: agent-cilk.c:163
bool LUSHI_do_metric(uint64_t incrMetricIn, bool *doMetric, bool *doMetricIdleness, uint64_t *incrMetric, double *incrMetricIdleness)
Definition: agent-cilk.c:557
bool LUSHI_ismycode(void *addr)
Definition: agent-cilk.c:170
lush_step_t LUSHI_step_pnote(lush_cursor_t *cursor)
Definition: agent-cilk.c:291
int LUSHI_set_active_frame_marker()
Definition: agent-cilk.c:372
#define doMetric(metricIdExpr, metricIncr, type)
Definition: ga-overrides.c:296
int lush_agentid_t
Definition: lush-support.h:99
int LUSHI_lip_eq(lush_lip_t *lip)
Definition: agent-cilk.c:532
enum lush_step lush_step_t
int LUSHI_lip_write()
Definition: agent-cilk.c:546
int LUSHI_lip_destroy(lush_lip_t *lip)
Definition: agent-cilk.c:525
cct_addr_t * addr
Definition: cct.c:130
int LUSHI_lip_read()
Definition: agent-cilk.c:539
LUSHI_DECL(int, LUSHI_init,(int argc, char **argv, lush_agentid_t aid, LUSHCB_malloc_fn_t malloc_fn, LUSHCB_free_fn_t free_fn, LUSHCB_step_fn_t step_fn, LUSHCB_loadmap_find_fn_t loadmap_fn))