Freigeben über


JitCompilationStart 

The JitCompilationStart managed debugging assistant (MDA) is activated to report when the just-in-time (JIT) compiler starts to compile a function.

Symptoms

The working set size increases for a program that is already in native image format because mscorjit.dll is loaded into the process.

Cause

Not all the assemblies the program depends on have been generated into native format, or those that have are not registered correctly.

Resolution

Enabling this MDA allows you to determine which function is being JIT-compiled. Determine whether the assembly that contains the function is generated to native format and properly registered.

Effect on the Runtime

This MDA logs a message just before a method is JIT-compiled, so enabling this MDA has significant impact on performance. Note that if a method is inline, this MDA will not generate a separate message.

Output

The following code sample shows sample output. In this case the output shows that in assembly Test the method "m" on class "ns2.CO" was JIT-compiled.

    method name="Test!ns2.C0::m"

Configuration

The following configuration file shows a variety of filters that can be employed to filter out which methods are reported when they are first JIT-compiled. You can specify that all methods be reported by setting the value of the name attribute to *.

<mdaConfig>
  <assistants>
    <jitCompilationStart>
      <methods>
        <match name="C0::m" />
        <match name="MyMethod" />
        <match name="C2::*" />
        <match name="ns0::*" />
        <match name="ns1.C0::*" />
        <match name="ns2.C0::m" />
        <match name="ns2.C0+N0::m" />
      </methods>
    </jitCompilationStart >
  </assistants>
</mdaConfig>

Example

The following code sample is intended to be used with the preceding configuration file.

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

public class Entry
{
    public static void Main(string[] args)
    {
        C0.m();
        C1.MyMethod();
        C2.m();

        ns0.C0.m();
        ns0.C0.N0.m();
        ns0.C1.m();

        ns1.C0.m();
        ns1.C0.N0.m();

        ns2.C0.m();
        ns2.C0.N0.m();
    }
}

public class C0
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void m() { }
}

public class C1
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void MyMethod() { }
}

public class C2
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void m() { }
}

namespace ns0
{
    public class C0
    {
        [MethodImpl(MethodImplOptions.NoInlining)]
        public static void m() { }

        public class N0
        {
            [MethodImpl(MethodImplOptions.NoInlining)]
            public static void m() { }
        }
    }

    public class C1
    {
        [MethodImpl(MethodImplOptions.NoInlining)]
        public static void m() { }
    }
}

namespace ns1
{
    public class C0
    {
        [MethodImpl(MethodImplOptions.NoInlining)]
        public static void m() { }
    }
    public class N0
    {
        [MethodImpl(MethodImplOptions.NoInlining)]
        public static void m() { }
    }
}

namespace ns2
{
    public class C0
    {
        [MethodImpl(MethodImplOptions.NoInlining)]
        public static void m() { }

        public class N0
        {
            [MethodImpl(MethodImplOptions.NoInlining)]
            public static void m() { }
        }
    }
}

See Also

Reference

MarshalAsAttribute

Concepts

Diagnosing Errors with Managed Debugging Assistants
Interop Marshaling Overview