michael@0: /* michael@0: This file is provided under a dual BSD/GPLv2 license. When using or michael@0: redistributing this file, you may do so under either license. michael@0: michael@0: GPL LICENSE SUMMARY michael@0: michael@0: Copyright (c) 2005-2013 Intel Corporation. All rights reserved. michael@0: michael@0: This program is free software; you can redistribute it and/or modify michael@0: it under the terms of version 2 of the GNU General Public License as michael@0: published by the Free Software Foundation. michael@0: michael@0: This program is distributed in the hope that it will be useful, but michael@0: WITHOUT ANY WARRANTY; without even the implied warranty of michael@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU michael@0: General Public License for more details. michael@0: michael@0: You should have received a copy of the GNU General Public License michael@0: along with this program; if not, write to the Free Software michael@0: Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. michael@0: The full GNU General Public License is included in this distribution michael@0: in the file called LICENSE.GPL. michael@0: michael@0: Contact Information: michael@0: http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ michael@0: michael@0: BSD LICENSE michael@0: michael@0: Copyright (c) 2005-2013 Intel Corporation. All rights reserved. michael@0: All rights reserved. michael@0: michael@0: Redistribution and use in source and binary forms, with or without michael@0: modification, are permitted provided that the following conditions michael@0: are met: michael@0: michael@0: * Redistributions of source code must retain the above copyright michael@0: notice, this list of conditions and the following disclaimer. michael@0: * Redistributions in binary form must reproduce the above copyright michael@0: notice, this list of conditions and the following disclaimer in michael@0: the documentation and/or other materials provided with the michael@0: distribution. michael@0: * Neither the name of Intel Corporation nor the names of its michael@0: contributors may be used to endorse or promote products derived michael@0: from this software without specific prior written permission. michael@0: michael@0: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS michael@0: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT michael@0: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR michael@0: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT michael@0: OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@0: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@0: LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, michael@0: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY michael@0: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT michael@0: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE michael@0: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. michael@0: */ michael@0: michael@0: #ifndef __JITPROFILING_H__ michael@0: #define __JITPROFILING_H__ michael@0: michael@0: /** michael@0: * @brief JIT Profiling APIs michael@0: * michael@0: * The JIT Profiling API is used to report information about just-in-time michael@0: * generated code that can be used by performance tools. The user inserts michael@0: * calls in the code generator to report information before JIT-compiled michael@0: * code goes to execution. This information is collected at runtime and used michael@0: * by tools like Intel(R) VTune(TM) Amplifier to display performance metrics michael@0: * associated with JIT-compiled code. michael@0: * michael@0: * These APIs can be used to\n michael@0: * **Profile trace-based and method-based JIT-compiled michael@0: * code**. Some examples of environments that you can profile with this APIs: michael@0: * dynamic JIT compilation of JavaScript code traces, OpenCL JIT execution, michael@0: * Java/.NET managed execution environments, and custom ISV JIT engines. michael@0: * michael@0: * @code michael@0: * #include michael@0: * michael@0: * if (iJIT_IsProfilingActive != iJIT_SAMPLING_ON) { michael@0: * return; michael@0: * } michael@0: * michael@0: * iJIT_Method_Load jmethod = {0}; michael@0: * jmethod.method_id = iJIT_GetNewMethodID(); michael@0: * jmethod.method_name = "method_name"; michael@0: * jmethod.class_file_name = "class_name"; michael@0: * jmethod.source_file_name = "source_file_name"; michael@0: * jmethod.method_load_address = code_addr; michael@0: * jmethod.method_size = code_size; michael@0: * michael@0: * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod); michael@0: * iJIT_NotifyEvent(iJVM_EVENT_TYPE_SHUTDOWN, NULL); michael@0: * @endcode michael@0: * michael@0: * * Expected behaviour: michael@0: * * If any iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites michael@0: * already reported method, then such a method becomes invalid and its michael@0: * memory region is treated as unloaded. VTune Amplifier displays the metrics michael@0: * collected by the method until it is overwritten. michael@0: * * If supplied line number information contains multiple source lines for michael@0: * the same assembly instruction (code location), then VTune Amplifier picks up michael@0: * the first line number. michael@0: * * Dynamically generated code can be associated with a module name. michael@0: * Use the iJIT_Method_Load_V2 structure.\n michael@0: * Clarification of some cases:\n michael@0: * * If you register a function with the same method ID multiple times michael@0: * specifying different module names, then the VTune Amplifier picks up michael@0: * the module name registered first. If you want to distinguish the same michael@0: * function between different JIT engines, supply different method IDs for michael@0: * each function. Other symbolic information (for example, source file) michael@0: * can be identical. michael@0: * michael@0: * **Analyze split functions** (multiple joint or disjoint code regions michael@0: * belonging to the same function) **including re-JIT** michael@0: * with potential overlapping of code regions in time, which is common in michael@0: * resource-limited environments. michael@0: * @code michael@0: * #include michael@0: * michael@0: * unsigned int method_id = iJIT_GetNewMethodID(); michael@0: * michael@0: * iJIT_Method_Load a = {0}; michael@0: * a.method_id = method_id; michael@0: * a.method_load_address = acode_addr; michael@0: * a.method_size = acode_size; michael@0: * michael@0: * iJIT_Method_Load b = {0}; michael@0: * b.method_id = method_id; michael@0: * b.method_load_address = baddr_second; michael@0: * b.method_size = bsize_second; michael@0: * michael@0: * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a); michael@0: * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&b); michael@0: * @endcode michael@0: * michael@0: * * Expected behaviour: michael@0: * * If a iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites michael@0: * already reported method, then such a method becomes invalid and michael@0: * its memory region is treated as unloaded. michael@0: * * All code regions reported with the same method ID are considered as michael@0: * belonging to the same method. Symbolic information (method name, michael@0: * source file name) will be taken from the first notification, all michael@0: * subsequent notifications with the same method ID will be processed michael@0: * only for line number table information. So, the VTune Amplifier will map michael@0: * samples to a source line using the line number table from the current michael@0: * notification while taking source file name from the very first one.\n michael@0: * Clarification of some cases:\n michael@0: * * If you register a second code region with a different source file michael@0: * name and the same method ID, then this information will be saved and michael@0: * will not be considered as an extension of the first code region, but michael@0: * VTune Amplifier will use source file of the first code region and map michael@0: * performance metrics incorrectly. michael@0: * * If you register a second code region with the same source file as michael@0: * for the first region and the same method ID, then source file will be michael@0: * discarded but VTune Amplifier will map metrics to the source file correctly. michael@0: * * If you register a second code region with a null source file and michael@0: * the same method ID, then provided line number info will be associated michael@0: * with the source file of the first code region. michael@0: * michael@0: * **Explore inline functions** including multi-level hierarchy of michael@0: * nested inlines to see how performance metrics are distributed through them. michael@0: * michael@0: * @code michael@0: * #include michael@0: * michael@0: * // method_id parent_id michael@0: * // [-- c --] 3000 2000 michael@0: * // [---- d -----] 2001 1000 michael@0: * // [---- b ----] 2000 1000 michael@0: * // [------------ a ----------------] 1000 n/a michael@0: * michael@0: * iJIT_Method_Load a = {0}; michael@0: * a.method_id = 1000; michael@0: * michael@0: * iJIT_Method_Inline_Load b = {0}; michael@0: * b.method_id = 2000; michael@0: * b.parent_method_id = 1000; michael@0: * michael@0: * iJIT_Method_Inline_Load c = {0}; michael@0: * c.method_id = 3000; michael@0: * c.parent_method_id = 2000; michael@0: * michael@0: * iJIT_Method_Inline_Load d = {0}; michael@0: * d.method_id = 2001; michael@0: * d.parent_method_id = 1000; michael@0: * michael@0: * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a); michael@0: * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&b); michael@0: * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&c); michael@0: * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&d); michael@0: * @endcode michael@0: * michael@0: * * Requirements: michael@0: * * Each inline (iJIT_Method_Inline_Load) method should be associated michael@0: * with two method IDs: one for itself, one for its immediate parent. michael@0: * * Address regions of inline methods of the same parent method cannot michael@0: * overlap each other. michael@0: * * Execution of the parent method must not be started until it and all michael@0: * its inlines are reported. michael@0: * * Expected behaviour: michael@0: * * In case of nested inlines an order of michael@0: * iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED events is not important. michael@0: * * If any event overwrites either inline method or top parent method, michael@0: * then the parent including inlines becomes invalid and its memory michael@0: * region is treated as unloaded. michael@0: * michael@0: * **Life time of allocated data**\n michael@0: * The client sends an event notification to the agent with event-specific michael@0: * data, which is a structure. The pointers in the structure refers to memory michael@0: * allocated by the client, which responsible for releasing it. The pointers are michael@0: * used by the iJIT_NotifyEvent method to copy client's data in a trace file michael@0: * and they are not used after the iJIT_NotifyEvent method returns. michael@0: * michael@0: */ michael@0: michael@0: /** michael@0: * @defgroup jitapi JIT Profiling michael@0: * @ingroup internal michael@0: * @{ michael@0: */ michael@0: michael@0: /** michael@0: * @enum iJIT_jvm_event michael@0: * @brief Enumerator for the types of notifications michael@0: */ michael@0: typedef enum iJIT_jvm_event michael@0: { michael@0: iJVM_EVENT_TYPE_SHUTDOWN = 2, /**< Send to shutdown the agent. michael@0: * Use NULL for event data. */ michael@0: michael@0: iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED = 13, /**< Send when a dynamic code is michael@0: * JIT compiled and loaded into michael@0: * memory by the JIT engine but michael@0: * before the code is executed. michael@0: * Use iJIT_Method_Load as event michael@0: * data. */ michael@0: /** @cond exclude_from_documentation */ michael@0: iJVM_EVENT_TYPE_METHOD_UNLOAD_START, /**< Send when a compiled dynamic michael@0: * code is being unloaded from memory. michael@0: * Use iJIT_Method_Load as event data.*/ michael@0: /** @endcond */ michael@0: michael@0: //TODO: add a note that line info assumes from method load michael@0: iJVM_EVENT_TYPE_METHOD_UPDATE, /**< Send to provide a new content for michael@0: * an early reported dynamic code. michael@0: * The previous content will be invalidate michael@0: * starting from time of the notification. michael@0: * Use iJIT_Method_Load as event data but michael@0: * required fields are following: michael@0: * - method_id identify the code to update. michael@0: * - method_load_address specify start address michael@0: * within identified code range michael@0: * where update should be started. michael@0: * - method_size specify length of updated code michael@0: * range. */ michael@0: michael@0: iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, /**< Send when an inline dynamic michael@0: * code is JIT compiled and loaded michael@0: * into memory by the JIT engine michael@0: * but before the parent code region michael@0: * is started executing. michael@0: * Use iJIT_Method_Inline_Load as event data.*/ michael@0: michael@0: /** @cond exclude_from_documentation */ michael@0: /* Legacy stuff. Do not use it. */ michael@0: iJVM_EVENT_TYPE_ENTER_NIDS = 19, michael@0: iJVM_EVENT_TYPE_LEAVE_NIDS, michael@0: /** @endcond */ michael@0: michael@0: iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2 /**< Send when a dynamic code is michael@0: * JIT compiled and loaded into michael@0: * memory by the JIT engine but michael@0: * before the code is executed. michael@0: * Use iJIT_Method_Load_V2 as event michael@0: * data. */ michael@0: } iJIT_JVM_EVENT; michael@0: michael@0: /** @cond exclude_from_documentation */ michael@0: /* Legacy stuff. Do not use it. */ michael@0: typedef enum _iJIT_ModeFlags michael@0: { michael@0: iJIT_NO_NOTIFICATIONS = 0x0000, michael@0: iJIT_BE_NOTIFY_ON_LOAD = 0x0001, michael@0: iJIT_BE_NOTIFY_ON_UNLOAD = 0x0002, michael@0: iJIT_BE_NOTIFY_ON_METHOD_ENTRY = 0x0004, michael@0: iJIT_BE_NOTIFY_ON_METHOD_EXIT = 0x0008 michael@0: michael@0: } iJIT_ModeFlags; michael@0: /** @endcond */ michael@0: michael@0: /** michael@0: * @enum _iJIT_IsProfilingActiveFlags michael@0: * @brief Enumerator for the agent's mode michael@0: */ michael@0: typedef enum _iJIT_IsProfilingActiveFlags michael@0: { michael@0: iJIT_NOTHING_RUNNING = 0x0000, /**< The agent is not running. michael@0: * iJIT_NotifyEvent calls will michael@0: * not be processed. */ michael@0: iJIT_SAMPLING_ON = 0x0001, /**< The agent is running and michael@0: * ready to process notifications. */ michael@0: michael@0: /** @cond exclude_from_documentation */ michael@0: /* Legacy. Call Graph is running */ michael@0: iJIT_CALLGRAPH_ON = 0x0002 michael@0: /** @endcond */ michael@0: michael@0: } iJIT_IsProfilingActiveFlags; michael@0: michael@0: /** @cond exclude_from_documentation */ michael@0: /* Legacy stuff. Do not use it. */ michael@0: typedef enum _iJDEnvironmentType michael@0: { michael@0: iJDE_JittingAPI = 2 michael@0: michael@0: } iJDEnvironmentType; michael@0: michael@0: typedef struct _iJIT_Method_Id michael@0: { michael@0: unsigned int method_id; michael@0: michael@0: } *piJIT_Method_Id, iJIT_Method_Id; michael@0: michael@0: typedef struct _iJIT_Method_NIDS michael@0: { michael@0: unsigned int method_id; /**< Unique method ID */ michael@0: unsigned int stack_id; /**< NOTE: no need to fill this field, michael@0: * it's filled by VTune Amplifier */ michael@0: char* method_name; /**< Method name (just the method, without the class) */ michael@0: michael@0: } *piJIT_Method_NIDS, iJIT_Method_NIDS; michael@0: /** @endcond */ michael@0: michael@0: typedef enum _iJIT_CodeType michael@0: { michael@0: iJIT_CT_UNKNOWN = 0, michael@0: iJIT_CT_CODE, // executable code michael@0: iJIT_CT_DATA, // this kind of “update” will be excluded from the function’s body. michael@0: iJIT_CT_EOF michael@0: } iJIT_CodeType; michael@0: michael@0: typedef struct _iJIT_Method_Update michael@0: { michael@0: unsigned int method_id; michael@0: void* load_address; michael@0: unsigned int size; michael@0: iJIT_CodeType type; michael@0: michael@0: } *piJIT_Method_Update, iJIT_Method_Update; michael@0: michael@0: /** michael@0: * @details Describes a single entry in the line number information of michael@0: * a code region that gives information about how the reported code region michael@0: * is mapped to source file. michael@0: * Intel(R) VTune(TM) Amplifier uses line number information to attribute michael@0: * the samples (virtual address) to a line number. \n michael@0: * It is acceptable to report different code addresses for the same source line: michael@0: * @code michael@0: * Offset LineNumber michael@0: * 1 2 michael@0: * 12 4 michael@0: * 15 2 michael@0: * 18 1 michael@0: * 21 30 michael@0: * michael@0: * VTune(TM) Amplifier XE contsructs the following table using the client data michael@0: * michael@0: * Code subrange Line number michael@0: * 0-1 2 michael@0: * 1-12 4 michael@0: * 12-15 2 michael@0: * 15-18 1 michael@0: * 18-21 30 michael@0: * @endcode michael@0: */ michael@0: typedef struct _LineNumberInfo michael@0: { michael@0: unsigned int Offset; /**< Offset from the begining of the code region. */ michael@0: unsigned int LineNumber; /**< Matching source line number offset (from beginning of source file). */ michael@0: michael@0: } *pLineNumberInfo, LineNumberInfo; michael@0: michael@0: /** michael@0: * Description of a JIT-compiled method michael@0: */ michael@0: typedef struct _iJIT_Method_Load michael@0: { michael@0: unsigned int method_id; /**< Unique method ID. michael@0: * Method ID cannot be smaller than 999. michael@0: * Either you use the API function michael@0: * iJIT_GetNewMethodID to get a valid and unique michael@0: * method ID, or you take care of ID uniqueness michael@0: * and correct range by yourself.\n michael@0: * You must use the same method ID for all code michael@0: * regions of the same method, otherwise different michael@0: * method IDs mean different methods. */ michael@0: michael@0: char* method_name; /** The name of the method. It can be optionally michael@0: * prefixed with its class name and appended with michael@0: * its complete signature. Can't be NULL. */ michael@0: michael@0: void* method_load_address; /** The start virtual address of the method code michael@0: * region. If NULL that data provided with michael@0: * event are not accepted. */ michael@0: michael@0: unsigned int method_size; /** The code size of the method in memory. michael@0: * If 0, then data provided with the event are not michael@0: * accepted. */ michael@0: michael@0: unsigned int line_number_size; /** The number of entries in the line number michael@0: * table.0 if none. */ michael@0: michael@0: pLineNumberInfo line_number_table; /** Pointer to the line numbers info michael@0: * array. Can be NULL if michael@0: * line_number_size is 0. See michael@0: * LineNumberInfo Structure for a michael@0: * description of a single entry in michael@0: * the line number info array */ michael@0: michael@0: unsigned int class_id; /** This field is obsolete. */ michael@0: michael@0: char* class_file_name; /** Class name. Can be NULL.*/ michael@0: michael@0: char* source_file_name; /** Source file name. Can be NULL.*/ michael@0: michael@0: void* user_data; /** This field is obsolete. */ michael@0: michael@0: unsigned int user_data_size; /** This field is obsolete. */ michael@0: michael@0: iJDEnvironmentType env; /** This field is obsolete. */ michael@0: michael@0: } *piJIT_Method_Load, iJIT_Method_Load; michael@0: michael@0: #pragma pack(push, 8) michael@0: /** michael@0: * Description of a JIT-compiled method michael@0: * michael@0: * When you use the iJIT_Method_Load_V2 structure to describe michael@0: * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2 michael@0: * as an event type to report it. michael@0: */ michael@0: typedef struct _iJIT_Method_Load_V2 michael@0: { michael@0: unsigned int method_id; /**< Unique method ID. michael@0: * Method ID cannot be smaller than 999. michael@0: * Either you use the API function michael@0: * iJIT_GetNewMethodID to get a valid and unique michael@0: * method ID, or you take care of ID uniqueness michael@0: * and correct range by yourself.\n michael@0: * You must use the same method ID for all code michael@0: * regions of the same method, otherwise different michael@0: * method IDs mean different methods. */ michael@0: michael@0: char* method_name; /** The name of the method. It can be optionally michael@0: * prefixed with its class name and appended with michael@0: * its complete signature. Can't be NULL. */ michael@0: michael@0: void* method_load_address; /** The start virtual address of the method code michael@0: * region. If NULL that data provided with michael@0: * event are not accepted. */ michael@0: michael@0: unsigned int method_size; /** The code size of the method in memory. michael@0: * If 0, then data provided with the event are not michael@0: * accepted. */ michael@0: michael@0: unsigned int line_number_size; /** The number of entries in the line number michael@0: * table.0 if none. */ michael@0: michael@0: pLineNumberInfo line_number_table; /** Pointer to the line numbers info michael@0: * array. Can be NULL if michael@0: * line_number_size is 0. See michael@0: * LineNumberInfo Structure for a michael@0: * description of a single entry in michael@0: * the line number info array */ michael@0: michael@0: char* class_file_name; /** Class name. Can be NULL.*/ michael@0: michael@0: char* source_file_name; /** Source file name. Can be NULL.*/ michael@0: michael@0: char* module_name; /** Module name. Can be NULL. michael@0: The module name can be useful for distinguishing among michael@0: different JIT engines. Intel VTune Amplifier will display michael@0: reported methods split by specified modules */ michael@0: michael@0: } *piJIT_Method_Load_V2, iJIT_Method_Load_V2; michael@0: #pragma pack(pop) michael@0: michael@0: /** michael@0: * Description of an inline JIT-compiled method michael@0: */ michael@0: typedef struct _iJIT_Method_Inline_Load michael@0: { michael@0: unsigned int method_id; /**< Unique method ID. michael@0: * Method ID cannot be smaller than 999. michael@0: * Either you use the API function michael@0: * iJIT_GetNewMethodID to get a valid and unique michael@0: * method ID, or you take care of ID uniqueness michael@0: * and correct range by yourself. */ michael@0: michael@0: unsigned int parent_method_id; /** Unique immediate parent's method ID. michael@0: * Method ID may not be smaller than 999. michael@0: * Either you use the API function michael@0: * iJIT_GetNewMethodID to get a valid and unique michael@0: * method ID, or you take care of ID uniqueness michael@0: * and correct range by yourself. */ michael@0: michael@0: char* method_name; /** The name of the method. It can be optionally michael@0: * prefixed with its class name and appended with michael@0: * its complete signature. Can't be NULL. */ michael@0: michael@0: void* method_load_address; /** The virtual address on which the method michael@0: * is inlined. If NULL, then data provided with michael@0: * the event are not accepted. */ michael@0: michael@0: unsigned int method_size; /** The code size of the method in memory. michael@0: * If 0 that data provided with event are not michael@0: * accepted. */ michael@0: michael@0: unsigned int line_number_size; /** The number of entries in the line number michael@0: * table. 0 if none. */ michael@0: michael@0: pLineNumberInfo line_number_table; /** Pointer to the line numbers info michael@0: * array. Can be NULL if michael@0: * line_number_size is 0. See michael@0: * LineNumberInfo Structure for a michael@0: * description of a single entry in michael@0: * the line number info array */ michael@0: michael@0: char* class_file_name; /** Class name. Can be NULL.*/ michael@0: michael@0: char* source_file_name; /** Source file name. Can be NULL.*/ michael@0: michael@0: } *piJIT_Method_Inline_Load, iJIT_Method_Inline_Load; michael@0: michael@0: /** @cond exclude_from_documentation */ michael@0: #ifdef __cplusplus michael@0: extern "C" { michael@0: #endif /* __cplusplus */ michael@0: michael@0: #ifndef CDECL michael@0: # if defined WIN32 || defined _WIN32 michael@0: # define CDECL __cdecl michael@0: # else /* defined WIN32 || defined _WIN32 */ michael@0: # if defined _M_X64 || defined _M_AMD64 || defined __x86_64__ michael@0: # define CDECL /* not actual on x86_64 platform */ michael@0: # else /* _M_X64 || _M_AMD64 || __x86_64__ */ michael@0: # define CDECL __attribute__ ((cdecl)) michael@0: # endif /* _M_X64 || _M_AMD64 || __x86_64__ */ michael@0: # endif /* defined WIN32 || defined _WIN32 */ michael@0: #endif /* CDECL */ michael@0: michael@0: #define JITAPI CDECL michael@0: /** @endcond */ michael@0: michael@0: /** michael@0: * @brief Generates a new unique method ID. michael@0: * michael@0: * You must use this API to obtain unique and valid method IDs for methods or michael@0: * traces reported to the agent if you don't have you own mechanism to generate michael@0: * unique method IDs. michael@0: * michael@0: * @return a new unique method ID. When out of unique method IDs, this API michael@0: * returns 0, which is not an accepted value. michael@0: */ michael@0: unsigned int JITAPI iJIT_GetNewMethodID(void); michael@0: michael@0: /** michael@0: * @brief Returns the current mode of the agent. michael@0: * michael@0: * @return iJIT_SAMPLING_ON, indicating that agent is running, or michael@0: * iJIT_NOTHING_RUNNING if no agent is running. michael@0: */ michael@0: iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void); michael@0: michael@0: /** michael@0: * @brief Reports infomation about JIT-compiled code to the agent. michael@0: * michael@0: * The reported information is used to attribute samples obtained from any michael@0: * Intel(R) VTune(TM) Amplifier collector. This API needs to be called michael@0: * after JIT compilation and before the first entry into the JIT compiled michael@0: * code. michael@0: * michael@0: * @param[in] event_type - type of the data sent to the agent michael@0: * @param[in] EventSpecificData - pointer to event-specific data michael@0: * michael@0: * @returns 1 on success, otherwise 0. michael@0: */ michael@0: int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData); michael@0: michael@0: /** @cond exclude_from_documentation */ michael@0: /* michael@0: * Do not use these legacy APIs, which are here for backward compatibility michael@0: * with Intel(R) VTune(TM) Performance Analyzer. michael@0: */ michael@0: typedef void (*iJIT_ModeChangedEx)(void *UserData, iJIT_ModeFlags Flags); michael@0: void JITAPI iJIT_RegisterCallbackEx(void *userdata, michael@0: iJIT_ModeChangedEx NewModeCallBackFuncEx); michael@0: void JITAPI FinalizeThread(void); michael@0: void JITAPI FinalizeProcess(void); michael@0: michael@0: #ifdef __cplusplus michael@0: } michael@0: #endif /* __cplusplus */ michael@0: /** @endcond */ michael@0: michael@0: /** @} jitapi group */ michael@0: michael@0: #endif /* __JITPROFILING_H__ */