“Manual code profiler” is used to analyze code’s performance
AX’s Code Profiler has some well-known problems.
1. Performance problems: collecting data can last very long if the analyzed code execution take more time. If the analyzed code executes in 30 minutes, then the data collection will be processed in few hours. In sum you try to modify your code and wait another few hours to see the result.
2. Code Profiler have some bugs (in AX 3.0 for example) and shows wrong result values.
Sometimes developers use Infolog and time counters. The main goal of the “manual code profiler” is to make control points quickly and easily and see results in a short time.
You can find the ManualProfiler class and the example job in the attached project.
You have to call ManualProfiler class’s methods before and after the analyzed code parts. And after that you can get the result: system’s tick count, method’s call count and average call’s elapsed time. If the method is called several times, then all that counts will be summed up.
In case you use several classes, you can use global cache in order to get the global results of analysis.