js/src/vtune/jitprofiling.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/vtune/jitprofiling.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,610 @@
     1.4 +/*
     1.5 +  This file is provided under a dual BSD/GPLv2 license.  When using or
     1.6 +  redistributing this file, you may do so under either license.
     1.7 +
     1.8 +  GPL LICENSE SUMMARY
     1.9 +
    1.10 +  Copyright (c) 2005-2013 Intel Corporation. All rights reserved.
    1.11 +
    1.12 +  This program is free software; you can redistribute it and/or modify
    1.13 +  it under the terms of version 2 of the GNU General Public License as
    1.14 +  published by the Free Software Foundation.
    1.15 +
    1.16 +  This program is distributed in the hope that it will be useful, but
    1.17 +  WITHOUT ANY WARRANTY; without even the implied warranty of
    1.18 +  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.19 +  General Public License for more details.
    1.20 +
    1.21 +  You should have received a copy of the GNU General Public License
    1.22 +  along with this program; if not, write to the Free Software
    1.23 +  Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
    1.24 +  The full GNU General Public License is included in this distribution
    1.25 +  in the file called LICENSE.GPL.
    1.26 +
    1.27 +  Contact Information:
    1.28 +  http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
    1.29 +
    1.30 +  BSD LICENSE
    1.31 +
    1.32 +  Copyright (c) 2005-2013 Intel Corporation. All rights reserved.
    1.33 +  All rights reserved.
    1.34 +
    1.35 +  Redistribution and use in source and binary forms, with or without
    1.36 +  modification, are permitted provided that the following conditions
    1.37 +  are met:
    1.38 +
    1.39 +    * Redistributions of source code must retain the above copyright
    1.40 +      notice, this list of conditions and the following disclaimer.
    1.41 +    * Redistributions in binary form must reproduce the above copyright
    1.42 +      notice, this list of conditions and the following disclaimer in
    1.43 +      the documentation and/or other materials provided with the
    1.44 +      distribution.
    1.45 +    * Neither the name of Intel Corporation nor the names of its
    1.46 +      contributors may be used to endorse or promote products derived
    1.47 +      from this software without specific prior written permission.
    1.48 +
    1.49 +  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.50 +  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.51 +  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.52 +  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    1.53 +  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.54 +  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.55 +  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    1.56 +  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    1.57 +  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    1.58 +  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    1.59 +  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.60 +*/
    1.61 +
    1.62 +#ifndef __JITPROFILING_H__
    1.63 +#define __JITPROFILING_H__
    1.64 +
    1.65 +/**
    1.66 + * @brief JIT Profiling APIs
    1.67 + *
    1.68 + * The JIT Profiling API is used to report information about just-in-time
    1.69 + * generated code that can be used by performance tools. The user inserts
    1.70 + * calls in the code generator to report information before JIT-compiled
    1.71 + * code goes to execution. This information is collected at runtime and used
    1.72 + * by tools like Intel(R) VTune(TM) Amplifier to display performance metrics
    1.73 + * associated with JIT-compiled code.
    1.74 + *
    1.75 + * These APIs can be used to\n
    1.76 + * **Profile trace-based and method-based JIT-compiled
    1.77 + * code**. Some examples of environments that you can profile with this APIs:
    1.78 + * dynamic JIT compilation of JavaScript code traces, OpenCL JIT execution,
    1.79 + * Java/.NET managed execution environments, and custom ISV JIT engines.
    1.80 + *
    1.81 + * @code
    1.82 + * #include <jitprofiling.h>
    1.83 + *
    1.84 + * if (iJIT_IsProfilingActive != iJIT_SAMPLING_ON) {
    1.85 + *     return;
    1.86 + * }
    1.87 + *
    1.88 + * iJIT_Method_Load jmethod = {0};
    1.89 + * jmethod.method_id = iJIT_GetNewMethodID();
    1.90 + * jmethod.method_name = "method_name";
    1.91 + * jmethod.class_file_name = "class_name";
    1.92 + * jmethod.source_file_name = "source_file_name";
    1.93 + * jmethod.method_load_address = code_addr;
    1.94 + * jmethod.method_size = code_size;
    1.95 + *
    1.96 + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod);
    1.97 + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_SHUTDOWN, NULL);
    1.98 + * @endcode
    1.99 + *
   1.100 + *  * Expected behaviour:
   1.101 + *    * If any iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites
   1.102 + *      already reported method, then such a method becomes invalid and its
   1.103 + *      memory region is treated as unloaded. VTune Amplifier displays the metrics
   1.104 + *      collected by the method until it is overwritten.
   1.105 + *    * If supplied line number information contains multiple source lines for
   1.106 + *      the same assembly instruction (code location), then VTune Amplifier picks up
   1.107 + *      the first line number.
   1.108 + *    * Dynamically generated code can be associated with a module name.
   1.109 + *      Use the iJIT_Method_Load_V2 structure.\n
   1.110 + *      Clarification of some cases:\n
   1.111 + *        * If you register a function with the same method ID multiple times
   1.112 + *          specifying different module names, then the VTune Amplifier picks up
   1.113 + *          the module name registered first. If you want to distinguish the same
   1.114 + *          function between different JIT engines, supply different method IDs for
   1.115 + *          each function. Other symbolic information (for example, source file)
   1.116 + *          can be identical.
   1.117 + *
   1.118 + * **Analyze split functions** (multiple joint or disjoint code regions
   1.119 + * belonging to the same function) **including re-JIT**
   1.120 + * with potential overlapping of code regions in time, which is common in
   1.121 + * resource-limited environments.
   1.122 + * @code
   1.123 + * #include <jitprofiling.h>
   1.124 + *
   1.125 + * unsigned int method_id = iJIT_GetNewMethodID();
   1.126 + *
   1.127 + * iJIT_Method_Load a = {0};
   1.128 + * a.method_id = method_id;
   1.129 + * a.method_load_address = acode_addr;
   1.130 + * a.method_size = acode_size;
   1.131 + *
   1.132 + * iJIT_Method_Load b = {0};
   1.133 + * b.method_id = method_id;
   1.134 + * b.method_load_address = baddr_second;
   1.135 + * b.method_size = bsize_second;
   1.136 + *
   1.137 + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a);
   1.138 + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&b);
   1.139 + * @endcode
   1.140 + *
   1.141 + *  * Expected behaviour:
   1.142 + *      * If a iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites
   1.143 + *        already reported method, then such a method becomes invalid and
   1.144 + *        its memory region is treated as unloaded.
   1.145 + *      * All code regions reported with the same method ID are considered as
   1.146 + *        belonging to the same method. Symbolic information (method name,
   1.147 + *        source file name) will be taken from the first notification, all
   1.148 + *        subsequent notifications with the same method ID will be processed
   1.149 + *        only for line number table information. So, the VTune Amplifier will map
   1.150 + *        samples to a source line using the line number table from the current
   1.151 + *        notification while taking source file name from the very first one.\n
   1.152 + *        Clarification of some cases:\n
   1.153 + *          * If you register a second code region with a different source file
   1.154 + *          name and the same method ID, then this information will be saved and
   1.155 + *          will not be considered as an extension of the first code region, but
   1.156 + *          VTune Amplifier will use source file of the first code region and map
   1.157 + *          performance metrics incorrectly.
   1.158 + *          * If you register a second code region with the same source file as
   1.159 + *          for the first region and the same method ID, then source file will be
   1.160 + *          discarded but VTune Amplifier will map metrics to the source file correctly.
   1.161 + *          * If you register a second code region with a null source file and
   1.162 + *          the same method ID, then provided line number info will be associated
   1.163 + *          with the source file of the first code region.
   1.164 + *
   1.165 + * **Explore inline functions** including multi-level hierarchy of
   1.166 + * nested inlines to see how performance metrics are distributed through them.
   1.167 + *
   1.168 + * @code
   1.169 + * #include <jitprofiling.h>
   1.170 + *
   1.171 + *  //                                    method_id   parent_id
   1.172 + *  //   [-- c --]                          3000        2000
   1.173 + *  //                  [---- d -----]      2001        1000
   1.174 + *  //  [---- b ----]                       2000        1000
   1.175 + *  // [------------ a ----------------]    1000         n/a
   1.176 + *
   1.177 + * iJIT_Method_Load a = {0};
   1.178 + * a.method_id = 1000;
   1.179 + *
   1.180 + * iJIT_Method_Inline_Load b = {0};
   1.181 + * b.method_id = 2000;
   1.182 + * b.parent_method_id = 1000;
   1.183 + *
   1.184 + * iJIT_Method_Inline_Load c = {0};
   1.185 + * c.method_id = 3000;
   1.186 + * c.parent_method_id = 2000;
   1.187 + *
   1.188 + * iJIT_Method_Inline_Load d = {0};
   1.189 + * d.method_id = 2001;
   1.190 + * d.parent_method_id = 1000;
   1.191 + *
   1.192 + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a);
   1.193 + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&b);
   1.194 + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&c);
   1.195 + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&d);
   1.196 + * @endcode
   1.197 + *
   1.198 + *  * Requirements:
   1.199 + *      * Each inline (iJIT_Method_Inline_Load) method should be associated
   1.200 + *        with two method IDs: one for itself, one for its immediate parent.
   1.201 + *      * Address regions of inline methods of the same parent method cannot
   1.202 + *        overlap each other.
   1.203 + *      * Execution of the parent method must not be started until it and all
   1.204 + *        its inlines are reported.
   1.205 + *  * Expected behaviour:
   1.206 + *      * In case of nested inlines an order of
   1.207 + *        iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED events is not important.
   1.208 + *      * If any event overwrites either inline method or top parent method,
   1.209 + *        then the parent including inlines becomes invalid and its memory
   1.210 + *        region is treated as unloaded.
   1.211 + *
   1.212 + * **Life time of allocated data**\n
   1.213 + * The client sends an event notification to the agent with event-specific
   1.214 + * data, which is a structure. The pointers in the structure refers to memory
   1.215 + * allocated by the client, which responsible for releasing it. The pointers are
   1.216 + * used by the iJIT_NotifyEvent method to copy client's data in a trace file
   1.217 + * and they are not used after the iJIT_NotifyEvent method returns.
   1.218 + *
   1.219 + */
   1.220 +
   1.221 +/**
   1.222 + * @defgroup jitapi JIT Profiling
   1.223 + * @ingroup internal
   1.224 + * @{
   1.225 + */
   1.226 +
   1.227 +/**
   1.228 + * @enum iJIT_jvm_event
   1.229 + * @brief Enumerator for the types of notifications
   1.230 + */
   1.231 +typedef enum iJIT_jvm_event
   1.232 +{
   1.233 +    iJVM_EVENT_TYPE_SHUTDOWN = 2,               /**< Send to shutdown the agent.
   1.234 +                                                 * Use NULL for event data. */
   1.235 +
   1.236 +    iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED = 13,  /**< Send when a dynamic code is
   1.237 +                                                 * JIT compiled and loaded into
   1.238 +                                                 * memory by the JIT engine but
   1.239 +                                                 * before the code is executed.
   1.240 +                                                 * Use iJIT_Method_Load as event
   1.241 +                                                 * data. */
   1.242 +/** @cond exclude_from_documentation */
   1.243 +    iJVM_EVENT_TYPE_METHOD_UNLOAD_START,    /**< Send when a compiled dynamic
   1.244 +                                             * code is being unloaded from memory.
   1.245 +                                             * Use iJIT_Method_Load as event data.*/
   1.246 +/** @endcond */
   1.247 +
   1.248 +//TODO: add a note that line info assumes from method load
   1.249 +    iJVM_EVENT_TYPE_METHOD_UPDATE,   /**< Send to provide a new content for
   1.250 +                                      * an early reported dynamic code.
   1.251 +                                      * The previous content will be invalidate
   1.252 +                                      * starting from time of the notification.
   1.253 +                                      * Use iJIT_Method_Load as event data but
   1.254 +                                      * required fields are following:
   1.255 +                                      * - method_id    identify the code to update.
   1.256 +                                      * - method_load_address    specify start address
   1.257 +                                      *                          within identified code range
   1.258 +                                      *                          where update should be started.
   1.259 +                                      * - method_size            specify length of updated code
   1.260 +                                      *                          range. */
   1.261 +
   1.262 +    iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, /**< Send when an inline dynamic
   1.263 +                                                  * code is JIT compiled and loaded
   1.264 +                                                  * into memory by the JIT engine
   1.265 +                                                  * but before the parent code region
   1.266 +                                                  * is started executing.
   1.267 +                                                  * Use iJIT_Method_Inline_Load as event data.*/
   1.268 +
   1.269 +/** @cond exclude_from_documentation */
   1.270 +    /* Legacy stuff. Do not use it. */
   1.271 +    iJVM_EVENT_TYPE_ENTER_NIDS = 19,
   1.272 +    iJVM_EVENT_TYPE_LEAVE_NIDS,
   1.273 +/** @endcond */
   1.274 +
   1.275 +    iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2  /**< Send when a dynamic code is
   1.276 +                                              * JIT compiled and loaded into
   1.277 +                                              * memory by the JIT engine but
   1.278 +                                              * before the code is executed.
   1.279 +                                              * Use iJIT_Method_Load_V2 as event
   1.280 +                                              * data. */
   1.281 +} iJIT_JVM_EVENT;
   1.282 +
   1.283 +/** @cond exclude_from_documentation */
   1.284 +/* Legacy stuff. Do not use it. */
   1.285 +typedef enum _iJIT_ModeFlags
   1.286 +{
   1.287 +    iJIT_NO_NOTIFICATIONS          = 0x0000,
   1.288 +    iJIT_BE_NOTIFY_ON_LOAD         = 0x0001,
   1.289 +    iJIT_BE_NOTIFY_ON_UNLOAD       = 0x0002,
   1.290 +    iJIT_BE_NOTIFY_ON_METHOD_ENTRY = 0x0004,
   1.291 +    iJIT_BE_NOTIFY_ON_METHOD_EXIT  = 0x0008
   1.292 +
   1.293 +} iJIT_ModeFlags;
   1.294 +/** @endcond */
   1.295 +
   1.296 +/**
   1.297 + * @enum _iJIT_IsProfilingActiveFlags
   1.298 + * @brief Enumerator for the agent's mode
   1.299 + */
   1.300 +typedef enum _iJIT_IsProfilingActiveFlags
   1.301 +{
   1.302 +    iJIT_NOTHING_RUNNING           = 0x0000,    /**< The agent is not running.
   1.303 +                                                 * iJIT_NotifyEvent calls will
   1.304 +                                                 * not be processed. */
   1.305 +    iJIT_SAMPLING_ON               = 0x0001,    /**< The agent is running and
   1.306 +                                                 * ready to process notifications. */
   1.307 +
   1.308 +/** @cond exclude_from_documentation */
   1.309 +    /* Legacy. Call Graph is running */
   1.310 +    iJIT_CALLGRAPH_ON              = 0x0002
   1.311 +/** @endcond */
   1.312 +
   1.313 +} iJIT_IsProfilingActiveFlags;
   1.314 +
   1.315 +/** @cond exclude_from_documentation */
   1.316 +/* Legacy stuff. Do not use it. */
   1.317 +typedef enum _iJDEnvironmentType
   1.318 +{
   1.319 +    iJDE_JittingAPI = 2
   1.320 +
   1.321 +} iJDEnvironmentType;
   1.322 +
   1.323 +typedef struct _iJIT_Method_Id
   1.324 +{
   1.325 +    unsigned int method_id;
   1.326 +
   1.327 +} *piJIT_Method_Id, iJIT_Method_Id;
   1.328 +
   1.329 +typedef struct _iJIT_Method_NIDS
   1.330 +{
   1.331 +    unsigned int method_id;     /**< Unique method ID */
   1.332 +    unsigned int stack_id;      /**< NOTE: no need to fill this field,
   1.333 +                                 * it's filled by VTune Amplifier */
   1.334 +    char*  method_name;         /**< Method name (just the method, without the class) */
   1.335 +
   1.336 +} *piJIT_Method_NIDS, iJIT_Method_NIDS;
   1.337 +/** @endcond */
   1.338 +
   1.339 +typedef enum _iJIT_CodeType
   1.340 +{
   1.341 +    iJIT_CT_UNKNOWN = 0,
   1.342 +    iJIT_CT_CODE,             // executable code
   1.343 +    iJIT_CT_DATA,             // this kind of “update” will be excluded from the function’s body.
   1.344 +    iJIT_CT_EOF
   1.345 +} iJIT_CodeType;
   1.346 +
   1.347 +typedef struct _iJIT_Method_Update
   1.348 +{
   1.349 +    unsigned int method_id;
   1.350 +    void* load_address;
   1.351 +    unsigned int size;
   1.352 +    iJIT_CodeType type;
   1.353 +
   1.354 +} *piJIT_Method_Update, iJIT_Method_Update;
   1.355 +
   1.356 +/**
   1.357 + * @details Describes a single entry in the line number information of
   1.358 + * a code region that gives information about how the reported code region
   1.359 + * is mapped to source file.
   1.360 + * Intel(R) VTune(TM) Amplifier uses line number information to attribute
   1.361 + * the samples (virtual address) to a line number. \n
   1.362 + * It is acceptable to report different code addresses for the same source line:
   1.363 + * @code
   1.364 + *   Offset LineNumber
   1.365 + *      1       2
   1.366 + *      12      4
   1.367 + *      15      2
   1.368 + *      18      1
   1.369 + *      21      30
   1.370 + *
   1.371 + *  VTune(TM) Amplifier XE contsructs the following table using the client data
   1.372 + *
   1.373 + *   Code subrange  Line number
   1.374 + *      0-1             2
   1.375 + *      1-12            4
   1.376 + *      12-15           2
   1.377 + *      15-18           1
   1.378 + *      18-21           30
   1.379 + * @endcode
   1.380 + */
   1.381 +typedef struct _LineNumberInfo
   1.382 +{
   1.383 +    unsigned int Offset;     /**< Offset from the begining of the code region. */
   1.384 +    unsigned int LineNumber; /**< Matching source line number offset (from beginning of source file). */
   1.385 +
   1.386 +} *pLineNumberInfo, LineNumberInfo;
   1.387 +
   1.388 +/**
   1.389 + *  Description of a JIT-compiled method
   1.390 + */
   1.391 +typedef struct _iJIT_Method_Load
   1.392 +{
   1.393 +    unsigned int method_id; /**< Unique method ID.
   1.394 +                             *  Method ID cannot be smaller than 999.
   1.395 +                             *  Either you use the API function
   1.396 +                             *  iJIT_GetNewMethodID to get a valid and unique
   1.397 +                             *  method ID, or you take care of ID uniqueness
   1.398 +                             *  and correct range by yourself.\n
   1.399 +                             *  You must use the same method ID for all code
   1.400 +                             *  regions of the same method, otherwise different
   1.401 +                             *  method IDs mean different methods. */
   1.402 +
   1.403 +    char* method_name; /** The name of the method. It can be optionally
   1.404 +                        *  prefixed with its class name and appended with
   1.405 +                        *  its complete signature. Can't be  NULL. */
   1.406 +
   1.407 +    void* method_load_address; /** The start virtual address of the method code
   1.408 +                                *  region. If NULL that data provided with
   1.409 +                                *  event are not accepted. */
   1.410 +
   1.411 +    unsigned int method_size; /** The code size of the method in memory.
   1.412 +                               *  If 0, then data provided with the event are not
   1.413 +                               *  accepted. */
   1.414 +
   1.415 +    unsigned int line_number_size; /** The number of entries in the line number
   1.416 +                                    *  table.0 if none. */
   1.417 +
   1.418 +    pLineNumberInfo line_number_table; /** Pointer to the line numbers info
   1.419 +                                        *  array. Can be NULL if
   1.420 +                                        *  line_number_size is 0. See
   1.421 +                                        *  LineNumberInfo Structure for a
   1.422 +                                        *  description of a single entry in
   1.423 +                                        *  the line number info array */
   1.424 +
   1.425 +    unsigned int class_id; /** This field is obsolete. */
   1.426 +
   1.427 +    char* class_file_name; /** Class name. Can be NULL.*/
   1.428 +
   1.429 +    char* source_file_name; /** Source file name. Can be NULL.*/
   1.430 +
   1.431 +    void* user_data; /** This field is obsolete. */
   1.432 +
   1.433 +    unsigned int user_data_size; /** This field is obsolete. */
   1.434 +
   1.435 +    iJDEnvironmentType  env; /** This field is obsolete. */
   1.436 +
   1.437 +} *piJIT_Method_Load, iJIT_Method_Load;
   1.438 +
   1.439 +#pragma pack(push, 8)
   1.440 +/**
   1.441 + *  Description of a JIT-compiled method
   1.442 + *
   1.443 + *  When you use the iJIT_Method_Load_V2 structure to describe
   1.444 + *  the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2
   1.445 + *  as an event type to report it.
   1.446 + */
   1.447 +typedef struct _iJIT_Method_Load_V2
   1.448 +{
   1.449 +    unsigned int method_id; /**< Unique method ID.
   1.450 +                             *  Method ID cannot be smaller than 999.
   1.451 +                             *  Either you use the API function
   1.452 +                             *  iJIT_GetNewMethodID to get a valid and unique
   1.453 +                             *  method ID, or you take care of ID uniqueness
   1.454 +                             *  and correct range by yourself.\n
   1.455 +                             *  You must use the same method ID for all code
   1.456 +                             *  regions of the same method, otherwise different
   1.457 +                             *  method IDs mean different methods. */
   1.458 +
   1.459 +    char* method_name; /** The name of the method. It can be optionally
   1.460 +                        *  prefixed with its class name and appended with
   1.461 +                        *  its complete signature. Can't be  NULL. */
   1.462 +
   1.463 +    void* method_load_address; /** The start virtual address of the method code
   1.464 +                                *  region. If NULL that data provided with
   1.465 +                                *  event are not accepted. */
   1.466 +
   1.467 +    unsigned int method_size; /** The code size of the method in memory.
   1.468 +                               *  If 0, then data provided with the event are not
   1.469 +                               *  accepted. */
   1.470 +
   1.471 +    unsigned int line_number_size; /** The number of entries in the line number
   1.472 +                                    *  table.0 if none. */
   1.473 +
   1.474 +    pLineNumberInfo line_number_table; /** Pointer to the line numbers info
   1.475 +                                        *  array. Can be NULL if
   1.476 +                                        *  line_number_size is 0. See
   1.477 +                                        *  LineNumberInfo Structure for a
   1.478 +                                        *  description of a single entry in
   1.479 +                                        *  the line number info array */
   1.480 +
   1.481 +    char* class_file_name; /** Class name. Can be NULL.*/
   1.482 +
   1.483 +    char* source_file_name; /** Source file name. Can be NULL.*/
   1.484 +
   1.485 +    char* module_name; /** Module name. Can be NULL.
   1.486 +                           The module name can be useful for distinguishing among
   1.487 +                           different JIT engines. Intel VTune Amplifier will display
   1.488 +                           reported methods split by specified modules */
   1.489 +
   1.490 +} *piJIT_Method_Load_V2, iJIT_Method_Load_V2;
   1.491 +#pragma pack(pop)
   1.492 +
   1.493 +/**
   1.494 + * Description of an inline JIT-compiled method
   1.495 + */
   1.496 +typedef struct _iJIT_Method_Inline_Load
   1.497 +{
   1.498 +    unsigned int method_id; /**< Unique method ID.
   1.499 +                             *  Method ID cannot be smaller than 999.
   1.500 +                             *  Either you use the API function
   1.501 +                             *  iJIT_GetNewMethodID to get a valid and unique
   1.502 +                             *  method ID, or you take care of ID uniqueness
   1.503 +                             *  and correct range by yourself. */
   1.504 +
   1.505 +    unsigned int parent_method_id; /** Unique immediate parent's method ID.
   1.506 +                                    *  Method ID may not be smaller than 999.
   1.507 +                                    *  Either you use the API function
   1.508 +                                    *  iJIT_GetNewMethodID to get a valid and unique
   1.509 +                                    *  method ID, or you take care of ID uniqueness
   1.510 +                                    *  and correct range by yourself. */
   1.511 +
   1.512 +    char* method_name; /** The name of the method. It can be optionally
   1.513 +                        *  prefixed with its class name and appended with
   1.514 +                        *  its complete signature. Can't be  NULL. */
   1.515 +
   1.516 +    void* method_load_address;  /** The virtual address on which the method
   1.517 +                                  * is inlined. If NULL, then data provided with
   1.518 +                                  * the event are not accepted. */
   1.519 +
   1.520 +    unsigned int method_size; /** The code size of the method in memory.
   1.521 +                               *  If 0 that data provided with event are not
   1.522 +                               *  accepted. */
   1.523 +
   1.524 +    unsigned int line_number_size; /** The number of entries in the line number
   1.525 +                                    *  table. 0 if none. */
   1.526 +
   1.527 +    pLineNumberInfo line_number_table; /** Pointer to the line numbers info
   1.528 +                                        *  array. Can be NULL if
   1.529 +                                        *  line_number_size is 0. See
   1.530 +                                        *  LineNumberInfo Structure for a
   1.531 +                                        *  description of a single entry in
   1.532 +                                        *  the line number info array */
   1.533 +
   1.534 +    char* class_file_name; /** Class name. Can be NULL.*/
   1.535 +
   1.536 +    char* source_file_name; /** Source file name. Can be NULL.*/
   1.537 +
   1.538 +} *piJIT_Method_Inline_Load, iJIT_Method_Inline_Load;
   1.539 +
   1.540 +/** @cond exclude_from_documentation */
   1.541 +#ifdef __cplusplus
   1.542 +extern "C" {
   1.543 +#endif /* __cplusplus */
   1.544 +
   1.545 +#ifndef CDECL
   1.546 +#  if defined WIN32 || defined _WIN32
   1.547 +#    define CDECL __cdecl
   1.548 +#  else /* defined WIN32 || defined _WIN32 */
   1.549 +#    if defined _M_X64 || defined _M_AMD64 || defined __x86_64__
   1.550 +#      define CDECL /* not actual on x86_64 platform */
   1.551 +#    else  /* _M_X64 || _M_AMD64 || __x86_64__ */
   1.552 +#      define CDECL __attribute__ ((cdecl))
   1.553 +#    endif /* _M_X64 || _M_AMD64 || __x86_64__ */
   1.554 +#  endif /* defined WIN32 || defined _WIN32 */
   1.555 +#endif /* CDECL */
   1.556 +
   1.557 +#define JITAPI CDECL
   1.558 +/** @endcond */
   1.559 +
   1.560 +/**
   1.561 + * @brief Generates a new unique method ID.
   1.562 + *
   1.563 + * You must use this API to obtain unique and valid method IDs for methods or
   1.564 + * traces reported to the agent if you don't have you own mechanism to generate
   1.565 + * unique method IDs.
   1.566 + *
   1.567 + * @return a new unique method ID. When out of unique method IDs, this API
   1.568 + * returns 0, which is not an accepted value.
   1.569 + */
   1.570 +unsigned int JITAPI iJIT_GetNewMethodID(void);
   1.571 +
   1.572 +/**
   1.573 + * @brief Returns the current mode of the agent.
   1.574 + *
   1.575 + * @return iJIT_SAMPLING_ON, indicating that agent is running, or
   1.576 + * iJIT_NOTHING_RUNNING if no agent is running.
   1.577 + */
   1.578 +iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void);
   1.579 +
   1.580 +/**
   1.581 + * @brief Reports infomation about JIT-compiled code to the agent.
   1.582 + *
   1.583 + * The reported information is used to attribute samples obtained from any
   1.584 + * Intel(R) VTune(TM) Amplifier collector. This API needs to be called
   1.585 + * after JIT compilation and before the first entry into the JIT compiled
   1.586 + * code.
   1.587 + *
   1.588 + * @param[in] event_type - type of the data sent to the agent
   1.589 + * @param[in] EventSpecificData - pointer to event-specific data
   1.590 + *
   1.591 + * @returns 1 on success, otherwise 0.
   1.592 + */
   1.593 +int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData);
   1.594 +
   1.595 +/** @cond exclude_from_documentation */
   1.596 +/*
   1.597 + * Do not use these legacy APIs, which are here for backward compatibility
   1.598 + * with Intel(R) VTune(TM) Performance Analyzer.
   1.599 + */
   1.600 +typedef void (*iJIT_ModeChangedEx)(void *UserData, iJIT_ModeFlags Flags);
   1.601 +void JITAPI iJIT_RegisterCallbackEx(void *userdata,
   1.602 +                                    iJIT_ModeChangedEx NewModeCallBackFuncEx);
   1.603 +void JITAPI FinalizeThread(void);
   1.604 +void JITAPI FinalizeProcess(void);
   1.605 +
   1.606 +#ifdef __cplusplus
   1.607 +}
   1.608 +#endif /* __cplusplus */
   1.609 +/** @endcond */
   1.610 +
   1.611 +/** @} jitapi group */
   1.612 +
   1.613 +#endif /* __JITPROFILING_H__ */

mercurial