Professional Documents
Culture Documents
Summary
Tool enhances existing Ax 2009 code profiling feature. Two main improvements:
1. Results processing is much faster - in proportion ~ 1 : 5. Processing takes 5 times longer than test
execution (for CPU intensive operations, DB and resource waits are even faster).
2. Profiling results are presented in context of source code editing. It means each source code line in
X++ editor gets execution statistics right next to it.
Code profile browser displays information for exact source code lines shown in X++ editor. In example
shown “47: 2.108ms #679c” means:
- Source code line number: 47 of SysBPCheck.doTreeNode()
- Total execution time: 2108ms (in executed test including all sub code)
- number of times executed: 6792
ADP Ax 2009 Code Profiler Page 1
Last changed: 2015 Sep
Ax project version: 1.0
- execution tier: c (can be c, s or * for both client and server)
Only lines actually executed will have info - blank lines means no execution. If time is negligible (less than 1
ms) only line number is shown, no time.
This approach really allows to switch focus form “finding” poorly performing code, to actually thinking
“how” to fix/improve it.
Installation
Code is distributed as XPO with shared project ADPCodePorfile. Regular import will do necessary thing.
Warning! Project contains class “EditorScirpts” which can be modified in your
system. Only method “aaCodeProfile” is needed.
Code is kept as compact as possible, so no security, labels, menu items etc.
Approach used in this project works on Ax 2012 to, simple form upgrade is needed.
Use
Class “ADPCodeProfile_Tutorial” is included in project to demonstrate two main usage scenarios:
1. run profiler from code – to analyze only problematic part of code.
2. Interactive – the same way as Ax standard code profiler. Start profiler, interact with Ax, when
required test is ready then stop and see results.
For interactive use or reviewing last profile simply open form ADPCodeProfileBrowse directly from AOT.
When form opens it reads in last profile and:
- Shows info log with top time consuming code trees
- Opens most time consuming root source code in X++ editor
Normal operation:
1. start new trace with "Start" button :)
2. do all the stuff needed, but not overdo it. The more code executed, the more time it takes to
process results, idling does not affect much.
3. "Stop" profiling will start processing result. "Cancel" button can be useful.
4. on completion info log is presented with most time consuming trees. AND the most consuming root
source code is opened in editor.
!! Now please pay attention !!
5. To actually see statistics in browser - in source code editor (X++ editor) right click > choose "Scripts"
> “aaCodeProfile”. This will refresh code profile browser form with information reflecting source
code shown in editor.
Like this:
Despite these imprecisions tool still allows to compare analyze source code and locate poorly performing
part. At the end it does not matter whether process was exactly 2.978 sec or 3.421.