Compartir a través de


Using the Code Profiler from X++

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

As an alternative to the graphical user interface, you can control the code profiler directly from your X++ code. For this purpose there are two macros:

  • #Profilebegin()

  • #ProfileEnd

These two macros have to be in the same level in a method.

Following is a simple job that shows the use of the macros:

    static void codeProfilerTest() 
    { 
        int   i, j; 
        ;   
        #profileBegin("test")   
        
        for(i=1;   i<=10; i++) 
        {   
            j+=   i*i; 
        }   
        
        info(strfmt("%1",j));   
        #profileEnd   
    } 

You will then have to find the collected data under Tools > Code profiler > Profiler runs, and process the data yourself by selecting Totals > Calculate sum.

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.