OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 Copyright(c) 2008-2011 Intel Corporation. All Rights Reserved. | |
3 | |
4 The source code contained or described herein and all documents related | |
5 to the source code ("Material") are owned by Intel Corporation or its | |
6 suppliers or licensors. Title to the Material remains with Intel | |
7 Corporation or its suppliers and licensors. The Material is protected | |
8 by worldwide copyright laws and treaty provisions. No part of the | |
9 Material may be used, copied, reproduced, modified, published, uploaded, | |
10 posted, transmitted, distributed, or disclosed in any way without | |
11 Intel's prior express written permission. | |
12 | |
13 No license under any patent, copyright, trade secret or other | |
14 intellectual property right is granted to or conferred upon you by | |
15 disclosure or delivery of the Materials, either expressly, by | |
16 implication, inducement, estoppel or otherwise. Any license under such | |
17 intellectual property rights must be express and approved by Intel in | |
18 writing. | |
danno
2013/02/25 20:25:38
I don't think we can include this file with this l
| |
19 */ | |
20 #ifndef __JITPROFILING_H__ | |
21 #define __JITPROFILING_H__ | |
22 | |
23 /*************************************** | |
24 * Various constants used by functions * | |
25 ***************************************/ | |
26 | |
27 /* event notification */ | |
28 typedef enum iJIT_jvm_event | |
29 { | |
30 | |
31 /* shutdown */ | |
32 iJVM_EVENT_TYPE_SHUTDOWN = 2, /* Program exiting | |
33 * EventSpecificData NA | |
34 */ | |
35 | |
36 | |
37 /* JIT profiling */ | |
38 iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED=13, /* issued after method code jit ted | |
39 * into memory but before code is executed | |
40 * EventSpecificData is an iJIT _Method_Load | |
41 */ | |
42 | |
43 iJVM_EVENT_TYPE_METHOD_UNLOAD_START, /* issued before unload. Method code will no | |
44 * longer be executed, but code and info | |
45 * are still in memory. The VTu ne profiler | |
46 * may capture method code only at this point | |
47 * EventSpecificData is iJIT_Me thod_Id | |
48 */ | |
49 | |
50 /* Method Profiling */ | |
51 | |
52 /* method name, Id and stack is supplied */ | |
53 iJVM_EVENT_TYPE_ENTER_NIDS = 19, /* issued when a method is abou t to be entered | |
54 * EventSpecificData is iJIT_Me thod_NIDS | |
55 */ | |
56 | |
57 /* method name, Id and stack is supplied */ | |
58 iJVM_EVENT_TYPE_LEAVE_NIDS /* issued when a method is abou t to be left | |
59 * EventSpecificData is iJIT_Me thod_NIDS | |
60 */ | |
61 } iJIT_JVM_EVENT; | |
62 | |
63 typedef enum _iJIT_ModeFlags | |
64 { | |
65 iJIT_NO_NOTIFICATIONS = 0x0000, /* No need to Notify VTune, | |
66 * Since VTune is not running | |
67 */ | |
68 iJIT_BE_NOTIFY_ON_LOAD = 0x0001, /* when turned on the jit must call | |
69 * iJIT_NotifyEvent | |
70 * ( | |
71 * iJVM_EVENT_TYPE_METHOD_L OAD_FINISHED, | |
72 * ) | |
73 * for all the method already j itted | |
74 */ | |
75 iJIT_BE_NOTIFY_ON_UNLOAD = 0x0002, /* when turned on the jit must call | |
76 * iJIT_NotifyEvent | |
77 * ( | |
78 * iJVM_EVENT_TYPE_METHOD_U NLOAD_FINISHED, | |
79 * ) for all the method that a re unloaded | |
80 */ | |
81 iJIT_BE_NOTIFY_ON_METHOD_ENTRY = 0x0004, /* when turned on the jit must instrument all | |
82 * the currently jited code wit h calls on | |
83 * method entries | |
84 */ | |
85 iJIT_BE_NOTIFY_ON_METHOD_EXIT = 0x0008 /* when turned on the jit must instrument all | |
86 * the currently jited code wit h calls | |
87 * on method exit | |
88 */ | |
89 } iJIT_ModeFlags; | |
90 | |
91 | |
92 /* Flags used by iJIT_IsProfilingActive() */ | |
93 typedef enum _iJIT_IsProfilingActiveFlags | |
94 { | |
95 iJIT_NOTHING_RUNNING = 0x0000, /* No profiler is running. Curr ently not used */ | |
96 iJIT_SAMPLING_ON = 0x0001, /* Sampling is running. This is the default value | |
97 * returned by iJIT_IsProfiling Active() | |
98 */ | |
99 iJIT_CALLGRAPH_ON = 0x0002 /* Call Graph is running */ | |
100 } iJIT_IsProfilingActiveFlags; | |
101 | |
102 /* Enumerator for the environment of methods*/ | |
103 typedef enum _iJDEnvironmentType | |
104 { | |
105 iJDE_JittingAPI = 2 | |
106 } iJDEnvironmentType; | |
107 | |
108 /********************************** | |
109 * Data structures for the events * | |
110 **********************************/ | |
111 | |
112 /* structure for the events: | |
113 * iJVM_EVENT_TYPE_METHOD_UNLOAD_START | |
114 */ | |
115 | |
116 typedef struct _iJIT_Method_Id | |
117 { | |
118 unsigned int method_id; /* Id of the method (same as the one passed in | |
119 * the iJIT_Method_Load struct | |
120 */ | |
121 | |
122 } *piJIT_Method_Id, iJIT_Method_Id; | |
123 | |
124 | |
125 /* structure for the events: | |
126 * iJVM_EVENT_TYPE_ENTER_NIDS, | |
127 * iJVM_EVENT_TYPE_LEAVE_NIDS, | |
128 * iJVM_EVENT_TYPE_EXCEPTION_OCCURRED_NIDS | |
129 */ | |
130 | |
131 typedef struct _iJIT_Method_NIDS | |
132 { | |
133 unsigned int method_id; /* unique method ID */ | |
134 unsigned int stack_id; /* NOTE: no need to fill this fie ld, | |
135 * it's filled by VTune */ | |
136 char* method_name; /* method name (just the method, | |
137 * without the class) | |
138 */ | |
139 } *piJIT_Method_NIDS, iJIT_Method_NIDS; | |
140 | |
141 /* structures for the events: | |
142 * iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED | |
143 */ | |
144 | |
145 typedef struct _LineNumberInfo | |
146 { | |
147 unsigned int Offset; /* x86 Offset from the begining of the method*/ | |
148 unsigned int LineNumber; /* source line number from the b egining of | |
149 * the source file | |
150 */ | |
151 | |
152 } *pLineNumberInfo, LineNumberInfo; | |
153 | |
154 typedef struct _iJIT_Method_Load | |
155 { | |
156 unsigned int method_id; /* unique method ID - can be any unique value, | |
157 * (except 0 - 999) | |
158 */ | |
159 char* method_name; /* method name (can be with or w ithout | |
160 * the class and signature, in a ny case | |
161 * the class name will be added to it) | |
162 */ | |
163 void* method_load_address; /* virtual address of that metho d | |
164 * - This determines the method range for the | |
165 * iJVM_EVENT_TYPE_ENTER/LEAVE_M ETHOD_ADDR | |
166 * events | |
167 */ | |
168 unsigned int method_size; /* Size in memory - Must be exac t */ | |
169 unsigned int line_number_size; /* Line Table size in number of entries | |
170 * - Zero if none | |
171 */ | |
172 pLineNumberInfo line_number_table; /* Pointer to the begining of th e line numbers | |
173 * info array | |
174 */ | |
175 unsigned int class_id; /* unique class ID */ | |
176 char* class_file_name; /* class file name */ | |
177 char* source_file_name; /* source file name */ | |
178 void* user_data; /* bits supplied by the user for saving in | |
179 * the JIT file | |
180 */ | |
181 unsigned int user_data_size; /* the size of the user data buf fer */ | |
182 iJDEnvironmentType env; /* NOTE: no need to fill this fi eld, | |
183 * it's filled by VTune | |
184 */ | |
185 } *piJIT_Method_Load, iJIT_Method_Load; | |
186 | |
187 /* API Functions */ | |
188 #ifdef __cplusplus | |
189 extern "C" { | |
190 #endif | |
191 | |
192 #ifndef CDECL | |
193 # if defined WIN32 || defined _WIN32 | |
194 # define CDECL __cdecl | |
195 # else /* defined WIN32 || defined _WIN32 */ | |
196 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__ | |
197 # define CDECL /* not actual on x86_64 platform */ | |
198 # else /* _M_X64 || _M_AMD64 || __x86_64__ */ | |
199 # define CDECL __attribute__ ((cdecl)) | |
200 # endif /* _M_X64 || _M_AMD64 || __x86_64__ */ | |
201 # endif /* defined WIN32 || defined _WIN32 */ | |
202 #endif /* CDECL */ | |
203 | |
204 #define JITAPI CDECL | |
205 | |
206 /* called when the settings are changed with new settings */ | |
207 typedef void (*iJIT_ModeChangedEx)(void *UserData, iJIT_ModeFlags Flags); | |
208 | |
209 int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData); | |
210 | |
211 /* The new mode call back routine */ | |
212 void JITAPI iJIT_RegisterCallbackEx(void *userdata, iJIT_ModeChangedEx NewModeCa llBackFuncEx); | |
213 | |
214 iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void); | |
215 | |
216 void JITAPI FinalizeThread(void); | |
217 | |
218 void JITAPI FinalizeProcess(void); | |
219 | |
220 unsigned int JITAPI iJIT_GetNewMethodID(void); | |
221 | |
222 #ifdef __cplusplus | |
223 } | |
224 #endif | |
225 | |
226 #endif /* __JITPROFILING_H__ */ | |
OLD | NEW |