Jun 7, 2013

Code Profiler in Dynamics AX 2012

There is a very good feature called code profiler. The Code Profiler measures and records the execution of each line of code, the time taken by each line ,the Parent(caller) and the child of the each lines, all these are saved to database for review, also it has variety of options to review the recorded information
We can use this tool to find and remove the performance bottlenecks to improve the performance of whole application, also its useful to understand the flow of others code quickly

Click Tools > Code profiler to open the Code Profiler tool.


  1. Navigate to the functionality that you want to test
  2. To limit the results displayed, check the Trace depth enabled check box, and then type the number of levels that you want to be displayed in the results.
  3. Click Start.
  4. Use the functionality you want to test.
  5. When testing is complete, click Stop.
  6. The system now saves all logged data to the database. This might take quite some time because a database record is created for each executed line of code.
  7. Write a description of your code profile in the Summary dialog.
  8. Click OK.
  9. The Profiler runs form opens. This enables you to view data collected by the profiler 
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.

That's it for now...

No comments: