blob: fba5cb70f85ba3b34ea75877487feef1b0cd0c8f [file] [log] [blame] [edit]
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Compile and Link with JIT API &mdash; ITT/JIT APIs Documentation documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=e59714d7" />
<link rel="canonical" href="https://intel.github.io/ittapi/src/using-jit-api.html" />
<script src="../_static/jquery.js?v=5d32c60e"></script>
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="JIT API Reference" href="jit-api-reference.html" />
<link rel="prev" title="Just-In-Time (JIT) API" href="jit-api-support.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home">
ITT/JIT APIs Documentation
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="build.html">Build from Source Code</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="api-support.html">Use the ITT/JIT APIs</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="api-support.html#c-c-api-usage-and-reference">C/C++ API Usage and Reference:</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="itt-api-support.html">Instrumentation and Tracing Technology (ITT) API</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="jit-api-support.html">Just-In-Time (JIT) API</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="jit-api-support.html#environment-variables-in-the-jit-profiling-api">Environment Variables in the JIT Profiling API</a></li>
<li class="toctree-l4"><a class="reference internal" href="jit-api-support.html#profile-trace-based-and-method-based-jit-compiled-code">Profile Trace-based and Method-based JIT-compiled Code</a></li>
<li class="toctree-l4"><a class="reference internal" href="jit-api-support.html#analyze-split-functions">Analyze Split Functions</a></li>
<li class="toctree-l4"><a class="reference internal" href="jit-api-support.html#explore-inline-functions">Explore Inline Functions</a></li>
<li class="toctree-l4 current"><a class="reference internal" href="jit-api-support.html#learn-more">Learn More</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api-support.html#other-language-api-bindings">Other Language API Bindings:</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="ref_collector.html">ITT API Reference Collector</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/intel/ittapi">GitHub Project</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">ITT/JIT APIs Documentation</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content style-external-links">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="api-support.html">Use the ITT/JIT APIs</a></li>
<li class="breadcrumb-item"><a href="jit-api-support.html">Just-In-Time (JIT) API</a></li>
<li class="breadcrumb-item active">Compile and Link with JIT API</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/src/using-jit-api.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="compile-and-link-with-jit-api">
<span id="using-jit-api"></span><h1>Compile and Link with JIT API<a class="headerlink" href="#compile-and-link-with-jit-api" title="Link to this heading"></a></h1>
<p>To include JIT Profiling support, do one of the following:</p>
<ul class="simple">
<li><p>Include the following files to your source tree:</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">jitprofiling.h</span></code>, located under <code class="docutils literal notranslate"><span class="pre">&lt;ittapi_dir&gt;\include</span></code> directory,
in your code. This header file provides all API function prototype
and type definitions.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ittnotify_config.h</span></code>, <code class="docutils literal notranslate"><span class="pre">ittnotify_types.h</span></code> and <code class="docutils literal notranslate"><span class="pre">jitprofiling.c</span></code>,
located under <code class="docutils literal notranslate"><span class="pre">&lt;ittapi_dir&gt;/src/ittnotify</span></code> directory.</p></li>
</ol>
</li>
<li><p>Link the jitprofiling Static Library:</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">jitprofiling.h</span></code>, located under <code class="docutils literal notranslate"><span class="pre">&lt;ittapi_dir&gt;\include</span></code> directory,
in your code. This header file provides all API function prototype
and type definitions.</p></li>
<li><p>Link to <code class="docutils literal notranslate"><span class="pre">jitprofiling.lib</span></code> (Windows*) or <code class="docutils literal notranslate"><span class="pre">jitprofiling.a</span></code> (Linux*),
located under <code class="docutils literal notranslate"><span class="pre">&lt;ittapi_dir&gt;\build_&lt;target_platform&gt;\&lt;target_bits&gt;\bin</span></code>
directory.</p></li>
</ol>
</li>
</ul>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Use This Primitive</p></th>
<th class="head"><p>To Do This</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="nf">iJIT_NotifyEvent</span><span class="p">(</span><span class="w"> </span><span class="n">iJIT_JVM_EVENT</span><span class="w"> </span><span class="n">event_type</span><span class="p">,</span>
<span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="o">*</span><span class="n">EventSpecificData</span><span class="w"> </span><span class="p">);</span>
</pre></div>
</div>
</td>
<td><p>Use this API to send a notification of <code class="docutils literal notranslate"><span class="pre">event_type</span></code> with the data pointed
by <code class="docutils literal notranslate"><span class="pre">EventSpecificData</span></code> to the agent. The reported information is used to
attribute samples obtained from any profiling tool collector.</p></td>
</tr>
<tr class="row-odd"><td><div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="kt">unsigned</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="nf">iJIT_GetNewMethodID</span><span class="p">(</span><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="p">);</span>
</pre></div>
</div>
</td>
<td><p>Generate a new method ID. You must use this function to assign unique and
valid method IDs to methods reported to the profiler. This API returns a new
unique method ID. When out of unique method IDs, this API function returns 0.</p></td>
</tr>
<tr class="row-even"><td><div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">iJIT_IsProfilingActiveFlags</span><span class="w"> </span><span class="nf">iJIT_IsProfilingActive</span><span class="p">(</span><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="p">);</span>
</pre></div>
</div>
</td>
<td><p>Returns the current mode of the profiler: off, or sampling, using the
<code class="docutils literal notranslate"><span class="pre">iJIT_IsProfilingActiveFlags</span></code> enumeration. This API returns
<code class="docutils literal notranslate"><span class="pre">iJIT_SAMPLING_ON</span></code> by default, indicating that Sampling is running.
It returns <code class="docutils literal notranslate"><span class="pre">iJIT_NOTHING_RUNNING</span></code> if no profiler is running.</p></td>
</tr>
</tbody>
</table>
<section id="lifetime-of-allocated-data">
<h2>Lifetime of Allocated Data<a class="headerlink" href="#lifetime-of-allocated-data" title="Link to this heading"></a></h2>
<p>You send an event notification to the agent (Collector) with event-specific
data, which is a structure. The pointers in the structure refer to memory that
you allocated. You are responsible for releasing the allocated memory. The
<code class="docutils literal notranslate"><span class="pre">iJIT_NotifyEvent</span></code> method uses these pointers to copy your data in a trace
file. The pointers are not used after the <code class="docutils literal notranslate"><span class="pre">iJIT_NotifyEvent</span></code> method returns.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="jit-api-support.html" class="btn btn-neutral float-left" title="Just-In-Time (JIT) API" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="jit-api-reference.html" class="btn btn-neutral float-right" title="JIT API Reference" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2025 Intel Corporation.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>