HPCToolkit
agent-tbb.c
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: Logical Unwind Support for HPCToolkit
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 //************************* System Include Files ****************************
64 
65 #include <stdlib.h>
66 #include <stdbool.h>
67 
68 #include <string.h>
69 
70 #include <assert.h>
71 
72 //*************************** User Include Files ****************************
73 
74 #include "agent-tbb.h"
75 
76 //*************************** Forward Declarations **************************
77 
78 #define LUSHCB_DECL(FN) \
79  LUSH ## FN ## _fn_t FN
80 
81 LUSHCB_DECL(CB_malloc);
82 LUSHCB_DECL(CB_free);
83 LUSHCB_DECL(CB_step);
84 LUSHCB_DECL(CB_loadmap_find);
85 // lush_cursor stuff
86 
87 #undef LUSHCB_DECL
88 
90 
91 // **************************************************************************
92 // Initialization/Finalization
93 // **************************************************************************
94 
95 extern int
96 LUSHI_init(int argc, char** argv,
97  lush_agentid_t aid,
98  LUSHCB_malloc_fn_t malloc_fn,
99  LUSHCB_free_fn_t free_fn,
100  LUSHCB_step_fn_t step_fn,
101  LUSHCB_loadmap_find_fn_t loadmap_fn)
102 {
103  MY_lush_aid = aid;
104 
105  CB_malloc = malloc_fn;
106  CB_free = free_fn;
107  CB_step = step_fn;
108  CB_loadmap_find = loadmap_fn;
109 
110  return 0;
111 }
112 
113 
114 extern int
116 {
117  return 0;
118 }
119 
120 
121 extern char*
122 LUSHI_strerror(int code)
123 {
124  return ""; // STUB
125 }
126 
127 
128 // **************************************************************************
129 // Maintaining Responsibility for Code/Frame-space
130 // **************************************************************************
131 
132 extern int
134 {
135  return 0; // FIXME: coordinate with dylib stuff
136 }
137 
138 
139 extern bool
141 {
142  // NOTE: Currently, this does not prevent our LUSHI_do_backtrace
143  // from being called, but it may not be quite right in the context
144  // of multiple agents.
145  return false; // force LUSH to use the identity logical unwind
146 }
147 
148 
149 // **************************************************************************
150 //
151 // **************************************************************************
152 
153 extern lush_step_t
155 {
156  assert(0 && "LUSHI_step_bichord: should never be called");
157  return LUSH_STEP_ERROR;
158 }
159 
160 
161 extern lush_step_t
163 {
164  assert(0 && "LUSHI_step_pnote: should never be called");
165  return LUSH_STEP_ERROR;
166 }
167 
168 
169 extern lush_step_t
171 {
172  assert(0 && "LUSHI_step_lnote: should never be called");
173  return LUSH_STEP_ERROR;
174 }
175 
176 
177 extern int
179 {
180  return 0; // STUB
181 }
182 
183 
184 // **************************************************************************
185 //
186 // **************************************************************************
187 
188 extern int
190 {
191  return 0; // STUB
192 }
193 
194 
195 extern int
197 {
198  return 0; // STUB
199 }
200 
201 
202 extern int
204 {
205  return 0; // STUB
206 }
207 
208 
209 extern int
211 {
212  return 0; // STUB
213 }
214 
215 
216 // **************************************************************************
217 // Metrics
218 // **************************************************************************
219 
220 extern bool
221 LUSHI_do_metric(uint64_t incrMetricIn,
222  bool* doMetric, bool* doMetricIdleness,
223  uint64_t* incrMetric, double* incrMetricIdleness)
224 {
225  *doMetric = true;
226  *doMetricIdleness = false;
227  *incrMetric = incrMetricIn;
228  *incrMetricIdleness = 0.0;
229 
230  return *doMetric;
231 }
232 
233 
234 // **************************************************************************
int LUSHI_lip_eq(lush_lip_t *lip)
Definition: agent-tbb.c:196
int LUSHI_lip_destroy(lush_lip_t *lip)
Definition: agent-tbb.c:189
bool LUSHI_ismycode(void *addr)
Definition: agent-tbb.c:140
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-tbb.c:96
int LUSHI_reg_dlopen()
Definition: agent-tbb.c:133
lush_step_t LUSHI_step_lnote(lush_cursor_t *cursor)
Definition: agent-tbb.c:170
int LUSHI_lip_read()
Definition: agent-tbb.c:203
#define doMetric(metricIdExpr, metricIncr, type)
Definition: ga-overrides.c:296
int lush_agentid_t
Definition: lush-support.h:99
lush_step_t LUSHI_step_pnote(lush_cursor_t *cursor)
Definition: agent-tbb.c:162
char * LUSHI_strerror(int code)
Definition: agent-tbb.c:122
lush_step_t LUSHI_step_bichord(lush_cursor_t *cursor)
Definition: agent-tbb.c:154
static lush_agentid_t MY_lush_aid
Definition: agent-tbb.c:89
bool LUSHI_do_metric(uint64_t incrMetricIn, bool *doMetric, bool *doMetricIdleness, uint64_t *incrMetric, double *incrMetricIdleness)
Definition: agent-tbb.c:221
enum lush_step lush_step_t
#define LUSHCB_DECL(FN)
Definition: agent-tbb.c:78
int LUSHI_set_active_frame_marker()
Definition: agent-tbb.c:178
cct_addr_t * addr
Definition: cct.c:130
int LUSHI_fini()
Definition: agent-tbb.c:115
int LUSHI_lip_write()
Definition: agent-tbb.c:210