|
1 /* |
|
2 This file is provided under a dual BSD/GPLv2 license. When using or |
|
3 redistributing this file, you may do so under either license. |
|
4 |
|
5 GPL LICENSE SUMMARY |
|
6 |
|
7 Copyright (c) 2005-2013 Intel Corporation. All rights reserved. |
|
8 |
|
9 This program is free software; you can redistribute it and/or modify |
|
10 it under the terms of version 2 of the GNU General Public License as |
|
11 published by the Free Software Foundation. |
|
12 |
|
13 This program is distributed in the hope that it will be useful, but |
|
14 WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 General Public License for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with this program; if not, write to the Free Software |
|
20 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
|
21 The full GNU General Public License is included in this distribution |
|
22 in the file called LICENSE.GPL. |
|
23 |
|
24 Contact Information: |
|
25 http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ |
|
26 |
|
27 BSD LICENSE |
|
28 |
|
29 Copyright (c) 2005-2013 Intel Corporation. All rights reserved. |
|
30 All rights reserved. |
|
31 |
|
32 Redistribution and use in source and binary forms, with or without |
|
33 modification, are permitted provided that the following conditions |
|
34 are met: |
|
35 |
|
36 * Redistributions of source code must retain the above copyright |
|
37 notice, this list of conditions and the following disclaimer. |
|
38 * Redistributions in binary form must reproduce the above copyright |
|
39 notice, this list of conditions and the following disclaimer in |
|
40 the documentation and/or other materials provided with the |
|
41 distribution. |
|
42 * Neither the name of Intel Corporation nor the names of its |
|
43 contributors may be used to endorse or promote products derived |
|
44 from this software without specific prior written permission. |
|
45 |
|
46 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
47 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
48 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
49 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
50 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
51 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
52 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
53 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
54 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
55 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
56 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
57 */ |
|
58 |
|
59 #ifndef __JITPROFILING_H__ |
|
60 #define __JITPROFILING_H__ |
|
61 |
|
62 /** |
|
63 * @brief JIT Profiling APIs |
|
64 * |
|
65 * The JIT Profiling API is used to report information about just-in-time |
|
66 * generated code that can be used by performance tools. The user inserts |
|
67 * calls in the code generator to report information before JIT-compiled |
|
68 * code goes to execution. This information is collected at runtime and used |
|
69 * by tools like Intel(R) VTune(TM) Amplifier to display performance metrics |
|
70 * associated with JIT-compiled code. |
|
71 * |
|
72 * These APIs can be used to\n |
|
73 * **Profile trace-based and method-based JIT-compiled |
|
74 * code**. Some examples of environments that you can profile with this APIs: |
|
75 * dynamic JIT compilation of JavaScript code traces, OpenCL JIT execution, |
|
76 * Java/.NET managed execution environments, and custom ISV JIT engines. |
|
77 * |
|
78 * @code |
|
79 * #include <jitprofiling.h> |
|
80 * |
|
81 * if (iJIT_IsProfilingActive != iJIT_SAMPLING_ON) { |
|
82 * return; |
|
83 * } |
|
84 * |
|
85 * iJIT_Method_Load jmethod = {0}; |
|
86 * jmethod.method_id = iJIT_GetNewMethodID(); |
|
87 * jmethod.method_name = "method_name"; |
|
88 * jmethod.class_file_name = "class_name"; |
|
89 * jmethod.source_file_name = "source_file_name"; |
|
90 * jmethod.method_load_address = code_addr; |
|
91 * jmethod.method_size = code_size; |
|
92 * |
|
93 * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod); |
|
94 * iJIT_NotifyEvent(iJVM_EVENT_TYPE_SHUTDOWN, NULL); |
|
95 * @endcode |
|
96 * |
|
97 * * Expected behaviour: |
|
98 * * If any iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites |
|
99 * already reported method, then such a method becomes invalid and its |
|
100 * memory region is treated as unloaded. VTune Amplifier displays the metrics |
|
101 * collected by the method until it is overwritten. |
|
102 * * If supplied line number information contains multiple source lines for |
|
103 * the same assembly instruction (code location), then VTune Amplifier picks up |
|
104 * the first line number. |
|
105 * * Dynamically generated code can be associated with a module name. |
|
106 * Use the iJIT_Method_Load_V2 structure.\n |
|
107 * Clarification of some cases:\n |
|
108 * * If you register a function with the same method ID multiple times |
|
109 * specifying different module names, then the VTune Amplifier picks up |
|
110 * the module name registered first. If you want to distinguish the same |
|
111 * function between different JIT engines, supply different method IDs for |
|
112 * each function. Other symbolic information (for example, source file) |
|
113 * can be identical. |
|
114 * |
|
115 * **Analyze split functions** (multiple joint or disjoint code regions |
|
116 * belonging to the same function) **including re-JIT** |
|
117 * with potential overlapping of code regions in time, which is common in |
|
118 * resource-limited environments. |
|
119 * @code |
|
120 * #include <jitprofiling.h> |
|
121 * |
|
122 * unsigned int method_id = iJIT_GetNewMethodID(); |
|
123 * |
|
124 * iJIT_Method_Load a = {0}; |
|
125 * a.method_id = method_id; |
|
126 * a.method_load_address = acode_addr; |
|
127 * a.method_size = acode_size; |
|
128 * |
|
129 * iJIT_Method_Load b = {0}; |
|
130 * b.method_id = method_id; |
|
131 * b.method_load_address = baddr_second; |
|
132 * b.method_size = bsize_second; |
|
133 * |
|
134 * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a); |
|
135 * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&b); |
|
136 * @endcode |
|
137 * |
|
138 * * Expected behaviour: |
|
139 * * If a iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites |
|
140 * already reported method, then such a method becomes invalid and |
|
141 * its memory region is treated as unloaded. |
|
142 * * All code regions reported with the same method ID are considered as |
|
143 * belonging to the same method. Symbolic information (method name, |
|
144 * source file name) will be taken from the first notification, all |
|
145 * subsequent notifications with the same method ID will be processed |
|
146 * only for line number table information. So, the VTune Amplifier will map |
|
147 * samples to a source line using the line number table from the current |
|
148 * notification while taking source file name from the very first one.\n |
|
149 * Clarification of some cases:\n |
|
150 * * If you register a second code region with a different source file |
|
151 * name and the same method ID, then this information will be saved and |
|
152 * will not be considered as an extension of the first code region, but |
|
153 * VTune Amplifier will use source file of the first code region and map |
|
154 * performance metrics incorrectly. |
|
155 * * If you register a second code region with the same source file as |
|
156 * for the first region and the same method ID, then source file will be |
|
157 * discarded but VTune Amplifier will map metrics to the source file correctly. |
|
158 * * If you register a second code region with a null source file and |
|
159 * the same method ID, then provided line number info will be associated |
|
160 * with the source file of the first code region. |
|
161 * |
|
162 * **Explore inline functions** including multi-level hierarchy of |
|
163 * nested inlines to see how performance metrics are distributed through them. |
|
164 * |
|
165 * @code |
|
166 * #include <jitprofiling.h> |
|
167 * |
|
168 * // method_id parent_id |
|
169 * // [-- c --] 3000 2000 |
|
170 * // [---- d -----] 2001 1000 |
|
171 * // [---- b ----] 2000 1000 |
|
172 * // [------------ a ----------------] 1000 n/a |
|
173 * |
|
174 * iJIT_Method_Load a = {0}; |
|
175 * a.method_id = 1000; |
|
176 * |
|
177 * iJIT_Method_Inline_Load b = {0}; |
|
178 * b.method_id = 2000; |
|
179 * b.parent_method_id = 1000; |
|
180 * |
|
181 * iJIT_Method_Inline_Load c = {0}; |
|
182 * c.method_id = 3000; |
|
183 * c.parent_method_id = 2000; |
|
184 * |
|
185 * iJIT_Method_Inline_Load d = {0}; |
|
186 * d.method_id = 2001; |
|
187 * d.parent_method_id = 1000; |
|
188 * |
|
189 * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a); |
|
190 * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&b); |
|
191 * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&c); |
|
192 * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&d); |
|
193 * @endcode |
|
194 * |
|
195 * * Requirements: |
|
196 * * Each inline (iJIT_Method_Inline_Load) method should be associated |
|
197 * with two method IDs: one for itself, one for its immediate parent. |
|
198 * * Address regions of inline methods of the same parent method cannot |
|
199 * overlap each other. |
|
200 * * Execution of the parent method must not be started until it and all |
|
201 * its inlines are reported. |
|
202 * * Expected behaviour: |
|
203 * * In case of nested inlines an order of |
|
204 * iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED events is not important. |
|
205 * * If any event overwrites either inline method or top parent method, |
|
206 * then the parent including inlines becomes invalid and its memory |
|
207 * region is treated as unloaded. |
|
208 * |
|
209 * **Life time of allocated data**\n |
|
210 * The client sends an event notification to the agent with event-specific |
|
211 * data, which is a structure. The pointers in the structure refers to memory |
|
212 * allocated by the client, which responsible for releasing it. The pointers are |
|
213 * used by the iJIT_NotifyEvent method to copy client's data in a trace file |
|
214 * and they are not used after the iJIT_NotifyEvent method returns. |
|
215 * |
|
216 */ |
|
217 |
|
218 /** |
|
219 * @defgroup jitapi JIT Profiling |
|
220 * @ingroup internal |
|
221 * @{ |
|
222 */ |
|
223 |
|
224 /** |
|
225 * @enum iJIT_jvm_event |
|
226 * @brief Enumerator for the types of notifications |
|
227 */ |
|
228 typedef enum iJIT_jvm_event |
|
229 { |
|
230 iJVM_EVENT_TYPE_SHUTDOWN = 2, /**< Send to shutdown the agent. |
|
231 * Use NULL for event data. */ |
|
232 |
|
233 iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED = 13, /**< Send when a dynamic code is |
|
234 * JIT compiled and loaded into |
|
235 * memory by the JIT engine but |
|
236 * before the code is executed. |
|
237 * Use iJIT_Method_Load as event |
|
238 * data. */ |
|
239 /** @cond exclude_from_documentation */ |
|
240 iJVM_EVENT_TYPE_METHOD_UNLOAD_START, /**< Send when a compiled dynamic |
|
241 * code is being unloaded from memory. |
|
242 * Use iJIT_Method_Load as event data.*/ |
|
243 /** @endcond */ |
|
244 |
|
245 //TODO: add a note that line info assumes from method load |
|
246 iJVM_EVENT_TYPE_METHOD_UPDATE, /**< Send to provide a new content for |
|
247 * an early reported dynamic code. |
|
248 * The previous content will be invalidate |
|
249 * starting from time of the notification. |
|
250 * Use iJIT_Method_Load as event data but |
|
251 * required fields are following: |
|
252 * - method_id identify the code to update. |
|
253 * - method_load_address specify start address |
|
254 * within identified code range |
|
255 * where update should be started. |
|
256 * - method_size specify length of updated code |
|
257 * range. */ |
|
258 |
|
259 iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, /**< Send when an inline dynamic |
|
260 * code is JIT compiled and loaded |
|
261 * into memory by the JIT engine |
|
262 * but before the parent code region |
|
263 * is started executing. |
|
264 * Use iJIT_Method_Inline_Load as event data.*/ |
|
265 |
|
266 /** @cond exclude_from_documentation */ |
|
267 /* Legacy stuff. Do not use it. */ |
|
268 iJVM_EVENT_TYPE_ENTER_NIDS = 19, |
|
269 iJVM_EVENT_TYPE_LEAVE_NIDS, |
|
270 /** @endcond */ |
|
271 |
|
272 iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2 /**< Send when a dynamic code is |
|
273 * JIT compiled and loaded into |
|
274 * memory by the JIT engine but |
|
275 * before the code is executed. |
|
276 * Use iJIT_Method_Load_V2 as event |
|
277 * data. */ |
|
278 } iJIT_JVM_EVENT; |
|
279 |
|
280 /** @cond exclude_from_documentation */ |
|
281 /* Legacy stuff. Do not use it. */ |
|
282 typedef enum _iJIT_ModeFlags |
|
283 { |
|
284 iJIT_NO_NOTIFICATIONS = 0x0000, |
|
285 iJIT_BE_NOTIFY_ON_LOAD = 0x0001, |
|
286 iJIT_BE_NOTIFY_ON_UNLOAD = 0x0002, |
|
287 iJIT_BE_NOTIFY_ON_METHOD_ENTRY = 0x0004, |
|
288 iJIT_BE_NOTIFY_ON_METHOD_EXIT = 0x0008 |
|
289 |
|
290 } iJIT_ModeFlags; |
|
291 /** @endcond */ |
|
292 |
|
293 /** |
|
294 * @enum _iJIT_IsProfilingActiveFlags |
|
295 * @brief Enumerator for the agent's mode |
|
296 */ |
|
297 typedef enum _iJIT_IsProfilingActiveFlags |
|
298 { |
|
299 iJIT_NOTHING_RUNNING = 0x0000, /**< The agent is not running. |
|
300 * iJIT_NotifyEvent calls will |
|
301 * not be processed. */ |
|
302 iJIT_SAMPLING_ON = 0x0001, /**< The agent is running and |
|
303 * ready to process notifications. */ |
|
304 |
|
305 /** @cond exclude_from_documentation */ |
|
306 /* Legacy. Call Graph is running */ |
|
307 iJIT_CALLGRAPH_ON = 0x0002 |
|
308 /** @endcond */ |
|
309 |
|
310 } iJIT_IsProfilingActiveFlags; |
|
311 |
|
312 /** @cond exclude_from_documentation */ |
|
313 /* Legacy stuff. Do not use it. */ |
|
314 typedef enum _iJDEnvironmentType |
|
315 { |
|
316 iJDE_JittingAPI = 2 |
|
317 |
|
318 } iJDEnvironmentType; |
|
319 |
|
320 typedef struct _iJIT_Method_Id |
|
321 { |
|
322 unsigned int method_id; |
|
323 |
|
324 } *piJIT_Method_Id, iJIT_Method_Id; |
|
325 |
|
326 typedef struct _iJIT_Method_NIDS |
|
327 { |
|
328 unsigned int method_id; /**< Unique method ID */ |
|
329 unsigned int stack_id; /**< NOTE: no need to fill this field, |
|
330 * it's filled by VTune Amplifier */ |
|
331 char* method_name; /**< Method name (just the method, without the class) */ |
|
332 |
|
333 } *piJIT_Method_NIDS, iJIT_Method_NIDS; |
|
334 /** @endcond */ |
|
335 |
|
336 typedef enum _iJIT_CodeType |
|
337 { |
|
338 iJIT_CT_UNKNOWN = 0, |
|
339 iJIT_CT_CODE, // executable code |
|
340 iJIT_CT_DATA, // this kind of “update” will be excluded from the function’s body. |
|
341 iJIT_CT_EOF |
|
342 } iJIT_CodeType; |
|
343 |
|
344 typedef struct _iJIT_Method_Update |
|
345 { |
|
346 unsigned int method_id; |
|
347 void* load_address; |
|
348 unsigned int size; |
|
349 iJIT_CodeType type; |
|
350 |
|
351 } *piJIT_Method_Update, iJIT_Method_Update; |
|
352 |
|
353 /** |
|
354 * @details Describes a single entry in the line number information of |
|
355 * a code region that gives information about how the reported code region |
|
356 * is mapped to source file. |
|
357 * Intel(R) VTune(TM) Amplifier uses line number information to attribute |
|
358 * the samples (virtual address) to a line number. \n |
|
359 * It is acceptable to report different code addresses for the same source line: |
|
360 * @code |
|
361 * Offset LineNumber |
|
362 * 1 2 |
|
363 * 12 4 |
|
364 * 15 2 |
|
365 * 18 1 |
|
366 * 21 30 |
|
367 * |
|
368 * VTune(TM) Amplifier XE contsructs the following table using the client data |
|
369 * |
|
370 * Code subrange Line number |
|
371 * 0-1 2 |
|
372 * 1-12 4 |
|
373 * 12-15 2 |
|
374 * 15-18 1 |
|
375 * 18-21 30 |
|
376 * @endcode |
|
377 */ |
|
378 typedef struct _LineNumberInfo |
|
379 { |
|
380 unsigned int Offset; /**< Offset from the begining of the code region. */ |
|
381 unsigned int LineNumber; /**< Matching source line number offset (from beginning of source file). */ |
|
382 |
|
383 } *pLineNumberInfo, LineNumberInfo; |
|
384 |
|
385 /** |
|
386 * Description of a JIT-compiled method |
|
387 */ |
|
388 typedef struct _iJIT_Method_Load |
|
389 { |
|
390 unsigned int method_id; /**< Unique method ID. |
|
391 * Method ID cannot be smaller than 999. |
|
392 * Either you use the API function |
|
393 * iJIT_GetNewMethodID to get a valid and unique |
|
394 * method ID, or you take care of ID uniqueness |
|
395 * and correct range by yourself.\n |
|
396 * You must use the same method ID for all code |
|
397 * regions of the same method, otherwise different |
|
398 * method IDs mean different methods. */ |
|
399 |
|
400 char* method_name; /** The name of the method. It can be optionally |
|
401 * prefixed with its class name and appended with |
|
402 * its complete signature. Can't be NULL. */ |
|
403 |
|
404 void* method_load_address; /** The start virtual address of the method code |
|
405 * region. If NULL that data provided with |
|
406 * event are not accepted. */ |
|
407 |
|
408 unsigned int method_size; /** The code size of the method in memory. |
|
409 * If 0, then data provided with the event are not |
|
410 * accepted. */ |
|
411 |
|
412 unsigned int line_number_size; /** The number of entries in the line number |
|
413 * table.0 if none. */ |
|
414 |
|
415 pLineNumberInfo line_number_table; /** Pointer to the line numbers info |
|
416 * array. Can be NULL if |
|
417 * line_number_size is 0. See |
|
418 * LineNumberInfo Structure for a |
|
419 * description of a single entry in |
|
420 * the line number info array */ |
|
421 |
|
422 unsigned int class_id; /** This field is obsolete. */ |
|
423 |
|
424 char* class_file_name; /** Class name. Can be NULL.*/ |
|
425 |
|
426 char* source_file_name; /** Source file name. Can be NULL.*/ |
|
427 |
|
428 void* user_data; /** This field is obsolete. */ |
|
429 |
|
430 unsigned int user_data_size; /** This field is obsolete. */ |
|
431 |
|
432 iJDEnvironmentType env; /** This field is obsolete. */ |
|
433 |
|
434 } *piJIT_Method_Load, iJIT_Method_Load; |
|
435 |
|
436 #pragma pack(push, 8) |
|
437 /** |
|
438 * Description of a JIT-compiled method |
|
439 * |
|
440 * When you use the iJIT_Method_Load_V2 structure to describe |
|
441 * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2 |
|
442 * as an event type to report it. |
|
443 */ |
|
444 typedef struct _iJIT_Method_Load_V2 |
|
445 { |
|
446 unsigned int method_id; /**< Unique method ID. |
|
447 * Method ID cannot be smaller than 999. |
|
448 * Either you use the API function |
|
449 * iJIT_GetNewMethodID to get a valid and unique |
|
450 * method ID, or you take care of ID uniqueness |
|
451 * and correct range by yourself.\n |
|
452 * You must use the same method ID for all code |
|
453 * regions of the same method, otherwise different |
|
454 * method IDs mean different methods. */ |
|
455 |
|
456 char* method_name; /** The name of the method. It can be optionally |
|
457 * prefixed with its class name and appended with |
|
458 * its complete signature. Can't be NULL. */ |
|
459 |
|
460 void* method_load_address; /** The start virtual address of the method code |
|
461 * region. If NULL that data provided with |
|
462 * event are not accepted. */ |
|
463 |
|
464 unsigned int method_size; /** The code size of the method in memory. |
|
465 * If 0, then data provided with the event are not |
|
466 * accepted. */ |
|
467 |
|
468 unsigned int line_number_size; /** The number of entries in the line number |
|
469 * table.0 if none. */ |
|
470 |
|
471 pLineNumberInfo line_number_table; /** Pointer to the line numbers info |
|
472 * array. Can be NULL if |
|
473 * line_number_size is 0. See |
|
474 * LineNumberInfo Structure for a |
|
475 * description of a single entry in |
|
476 * the line number info array */ |
|
477 |
|
478 char* class_file_name; /** Class name. Can be NULL.*/ |
|
479 |
|
480 char* source_file_name; /** Source file name. Can be NULL.*/ |
|
481 |
|
482 char* module_name; /** Module name. Can be NULL. |
|
483 The module name can be useful for distinguishing among |
|
484 different JIT engines. Intel VTune Amplifier will display |
|
485 reported methods split by specified modules */ |
|
486 |
|
487 } *piJIT_Method_Load_V2, iJIT_Method_Load_V2; |
|
488 #pragma pack(pop) |
|
489 |
|
490 /** |
|
491 * Description of an inline JIT-compiled method |
|
492 */ |
|
493 typedef struct _iJIT_Method_Inline_Load |
|
494 { |
|
495 unsigned int method_id; /**< Unique method ID. |
|
496 * Method ID cannot be smaller than 999. |
|
497 * Either you use the API function |
|
498 * iJIT_GetNewMethodID to get a valid and unique |
|
499 * method ID, or you take care of ID uniqueness |
|
500 * and correct range by yourself. */ |
|
501 |
|
502 unsigned int parent_method_id; /** Unique immediate parent's method ID. |
|
503 * Method ID may not be smaller than 999. |
|
504 * Either you use the API function |
|
505 * iJIT_GetNewMethodID to get a valid and unique |
|
506 * method ID, or you take care of ID uniqueness |
|
507 * and correct range by yourself. */ |
|
508 |
|
509 char* method_name; /** The name of the method. It can be optionally |
|
510 * prefixed with its class name and appended with |
|
511 * its complete signature. Can't be NULL. */ |
|
512 |
|
513 void* method_load_address; /** The virtual address on which the method |
|
514 * is inlined. If NULL, then data provided with |
|
515 * the event are not accepted. */ |
|
516 |
|
517 unsigned int method_size; /** The code size of the method in memory. |
|
518 * If 0 that data provided with event are not |
|
519 * accepted. */ |
|
520 |
|
521 unsigned int line_number_size; /** The number of entries in the line number |
|
522 * table. 0 if none. */ |
|
523 |
|
524 pLineNumberInfo line_number_table; /** Pointer to the line numbers info |
|
525 * array. Can be NULL if |
|
526 * line_number_size is 0. See |
|
527 * LineNumberInfo Structure for a |
|
528 * description of a single entry in |
|
529 * the line number info array */ |
|
530 |
|
531 char* class_file_name; /** Class name. Can be NULL.*/ |
|
532 |
|
533 char* source_file_name; /** Source file name. Can be NULL.*/ |
|
534 |
|
535 } *piJIT_Method_Inline_Load, iJIT_Method_Inline_Load; |
|
536 |
|
537 /** @cond exclude_from_documentation */ |
|
538 #ifdef __cplusplus |
|
539 extern "C" { |
|
540 #endif /* __cplusplus */ |
|
541 |
|
542 #ifndef CDECL |
|
543 # if defined WIN32 || defined _WIN32 |
|
544 # define CDECL __cdecl |
|
545 # else /* defined WIN32 || defined _WIN32 */ |
|
546 # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__ |
|
547 # define CDECL /* not actual on x86_64 platform */ |
|
548 # else /* _M_X64 || _M_AMD64 || __x86_64__ */ |
|
549 # define CDECL __attribute__ ((cdecl)) |
|
550 # endif /* _M_X64 || _M_AMD64 || __x86_64__ */ |
|
551 # endif /* defined WIN32 || defined _WIN32 */ |
|
552 #endif /* CDECL */ |
|
553 |
|
554 #define JITAPI CDECL |
|
555 /** @endcond */ |
|
556 |
|
557 /** |
|
558 * @brief Generates a new unique method ID. |
|
559 * |
|
560 * You must use this API to obtain unique and valid method IDs for methods or |
|
561 * traces reported to the agent if you don't have you own mechanism to generate |
|
562 * unique method IDs. |
|
563 * |
|
564 * @return a new unique method ID. When out of unique method IDs, this API |
|
565 * returns 0, which is not an accepted value. |
|
566 */ |
|
567 unsigned int JITAPI iJIT_GetNewMethodID(void); |
|
568 |
|
569 /** |
|
570 * @brief Returns the current mode of the agent. |
|
571 * |
|
572 * @return iJIT_SAMPLING_ON, indicating that agent is running, or |
|
573 * iJIT_NOTHING_RUNNING if no agent is running. |
|
574 */ |
|
575 iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void); |
|
576 |
|
577 /** |
|
578 * @brief Reports infomation about JIT-compiled code to the agent. |
|
579 * |
|
580 * The reported information is used to attribute samples obtained from any |
|
581 * Intel(R) VTune(TM) Amplifier collector. This API needs to be called |
|
582 * after JIT compilation and before the first entry into the JIT compiled |
|
583 * code. |
|
584 * |
|
585 * @param[in] event_type - type of the data sent to the agent |
|
586 * @param[in] EventSpecificData - pointer to event-specific data |
|
587 * |
|
588 * @returns 1 on success, otherwise 0. |
|
589 */ |
|
590 int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData); |
|
591 |
|
592 /** @cond exclude_from_documentation */ |
|
593 /* |
|
594 * Do not use these legacy APIs, which are here for backward compatibility |
|
595 * with Intel(R) VTune(TM) Performance Analyzer. |
|
596 */ |
|
597 typedef void (*iJIT_ModeChangedEx)(void *UserData, iJIT_ModeFlags Flags); |
|
598 void JITAPI iJIT_RegisterCallbackEx(void *userdata, |
|
599 iJIT_ModeChangedEx NewModeCallBackFuncEx); |
|
600 void JITAPI FinalizeThread(void); |
|
601 void JITAPI FinalizeProcess(void); |
|
602 |
|
603 #ifdef __cplusplus |
|
604 } |
|
605 #endif /* __cplusplus */ |
|
606 /** @endcond */ |
|
607 |
|
608 /** @} jitapi group */ |
|
609 |
|
610 #endif /* __JITPROFILING_H__ */ |