dotMemory 2020.2 Help

Integrate Third-Party Tools with dotMemory

The JetBrains .NET tools (dotTrace, dotCover, and dotMemory) are based on a common profiler core. The core provides low-level profiling functionality like attaching to profiled processes, communication with the .NET runtime, collecting profiling data, and so on.

The profiler core provides a mechanism that lets third-party tools to integrate with JetBrains .NET tools. An example of such integration is Typemock Isolator running along with JetBrains dotTrace: Users not only test their code but also investigate performance problems.

Transparent integration concepts

When a JetBrains .NET tool profiles a process, it loads the profiler core into the profiled process. In case of transparent integration, profiling is initiated by a third-party tool. So, the third-party tool becomes responsible for loading the profiler core into the profiled process.

How to integrate your tool with dotMemory

  1. Before starting profiling, your tool must add the following values (32-bit and/or 64-bit) to the HKCU\SOFTWARE\JetBrains\Profiler\TransparentIntegration or HKLM\SOFTWARE\JetBrains\Profiler\TransparentIntegration registries:

    1. MemoryProfiler = "{3-rd party clsid}"

    2. MemoryProfiler_Path32 = "{3-rd party path to 32-bit shared library}"

    3. MemoryProfiler_Path64 = "{3-rd party path to 64-bit shared library}"

    4. MemoryProfiler_Attach = "{3-rd party clsid}"

    5. MemoryProfiler_Attach_Path32 = "{3-rd party path to 32-bit shared library}"

    6. MemoryProfiler_Attach_Path64 = "{3-rd party path to 64-bit shared library}"

  2. (Optional) If you're going to profile .NET Framework 2.0, 4.0, 4.5 – 4.5.2 processes, you should register your tool (a .dll with COM object) using regsvr32.

  3. To load the JetBrains profiler core into the profiled process, you should use the following data:

    • JETBRAINS_PROFILER_CORE_GUID– the profiler core GUID.

    • JETBRAINS_PROFILER_CORE_PATH32 or JETBRAINS_PROFILER_CORE_PATH64– the path to the profiler core .dll (32-bit and 64-bit correspondingly).

    You must take the values of these variables from the following sources (search the sources exactly in the specified order until the required value is found):

    1. HKCU\SOFTWARE\JetBrains\Profiler\Upid_<X>_<Y>

    2. HKLM\SOFTWARE\JetBrains\Profiler\Upid_<X>_<Y>

    3. Environment variables

    4. HKLM\SOFTWARE\JetBrains\Profiler\Global

    Where:

    • <X>– an unsigned decimal process id.

    • <Y>– a hexadecimal process start time in 100-nanosecond intervals since 01-Jan-1601 (UTC).

Last modified: 24 September 2020