使用 Microsoft Dynamics NAV Application Profiler 做 C/AL 程式碼追蹤和程式效能分析

  • 2530
  • 0

Microsoft Dynamics NAV Application Profiler 可以在 Microsoft Dynamics NAV 執行程式時進行監視,幫助您做 C/AL 程式碼追蹤和程式效能分析,本文說明如何安裝與使用。

 

簡介

Microsoft Dynamics NAV Application Profiler 可以在 Microsoft Dynamics NAV 執行程式時進行監視,幫助您做 C/AL 程式碼追蹤和程式效能分析。

Microsoft Dynamics NAV Application Profiler 網址:http://navappprofiler.codeplex.com/

影片教學:http://msdn.microsoft.com/en-us/dynamics/nav/dn768398

 

安裝 Microsoft Dynamics NAV Application Profiler

連結至網址:http://navappprofiler.codeplex.com/,點選 [download] 進行下載,目前版本為 0.0.0.4,下載後取得壓縮檔案 NavAppProfiler.zip。

image

將 NavAppProfiler.zip 進行解壓縮,共有五個檔案,包含兩個 dll 檔案、一個 Page 的 txt 檔案和一個 Table 的 txt 檔案、一個說明文件 readme.txt 檔案。

我們先將兩個 dll 檔案做 [解除封鎖] 的動作,在 [Microsoft.Diagnostics.Tracing.TraceEvent.dll] 按滑鼠右鍵,選擇 [內容]。

image

選擇 [解除封鎖],按 [確定]。

SNAGHTMLf0a4c93

在 [EtwPerformanceProfiler.dll] 按滑鼠右鍵,選擇 [內容]。

image

選擇 [解除封鎖],按 [確定]。

SNAGHTMLf0b3a5e

我們將 dll 以外的檔案移出 NavAppProfiler 資料夾。

image

將 NavAppProfiler 資料夾複製到以下兩個路徑中,讓 NAV Server Instance 和 RoleTailored Client 外掛 dll 增益集。

  • C:\Program Files\Microsoft Dynamics NAV\71\Service\Add-ins
  • C:\Program Files (x86)\Microsoft Dynamics NAV\71\RoleTailored Client\Add-ins

image

將著要開啟 [Enable Full C/AL Function Tracing] 功能,執行 [Microsoft Dynamics NAV 2013 R2 Administration],選擇 NAV Server Instance,按 [Edit]。

image

勾選 [Enable Full C/AL Function Tracing],按 [Save]。

image

出現 [The new settings value will not take effect until you stop and restartthe service.] 警告視窗,按 [OK]。

image

在您的 NAV Server Instance 上,按滑鼠右鍵,選擇 [Restart]。

image

按 [OK] 進行重置 NAV Server Instance。

image

接著將 Table 和 Page 匯入 NAV 中,執行 [Microsoft Dynamics NAV 2013 R2 Development Environment],選擇資料庫並開啟 [Object Designer] 後,按 [File] \ [Import]。

image

選擇 [TAB50000.txt] 檔案,按 [開啟]。

image

相同步驟,選擇 [PAG50000.txt] 按 [開啟]。

image

將 Table 和 Page 匯入後,選擇它們並且按 [F11] 進行 Compile 動作。

image

按 [是] 進行 Compile。

image

完成後,切換至 [Page],選擇 Page 50000 [Performance Profiler] 按 [Run] 執行程式。

image

 

使用 Microsoft Dynamics NAV Application Profiler

執行 Page 50000 [Performance Profiler] 後就可以來進監視,您可以調整 Threshold 門檻值,在此我設定為 10,按 [Start] 進行監視。

image

接著到 Microsoft Dynamics NAV 執行程式,例如我將一筆 Sales Orders 進行過帳。

image

直接出貨並開發票,按 [OK]。

image

在 Microsoft Dynamics NAV 執行程式,完成您想要監視的程式流程後,回到 Performance Profiler 按 [Stop] 停止監視。

image

您可以看到您剛才在 Microsoft Dynamics NAV 執行程式使用到的 C/AL 程式碼以及執行時間等效能監視結果。

image