Say Hello to the new “Performance Profiler”

While going through what is new in BC 2022 wave 1, I found out a cool tool.

Here comes the new Performance Profiler. While many have implemented Telemetry and got some insight into their processes, this is a step forward from Microsoft to bring Telemetry tools on the BC user interface.

Now, the concept of a profiler is not a futuristic functionality, it has been implemented on many platforms, like Java Profiling or SQL Server Profiler or even MS Edge Profiler.

A profiler is a code monitoring tool, a tool that helps trace, recreate, and troubleshoot various issues in code.

Nevertheless, seeing a profiler in Business Central is so refreshing.

Let’s do a quick test to see how that works at high level.

I added an action on Customer List page that does nothing.

Well, it does something, it is waiting for 5 seconds before ending.

pageextension 50100 CustomerListExt extends "Customer List"
{
    actions
    {
        addlast(Reports)
        {
            action(TestProfiler)
            {
                ApplicationArea = All;

                trigger OnAction()
                var
                    _DateTime: DateTime;
                begin
                    _DateTime := CurrentDateTime();
                    _DateTime := CreateDateTime(DT2Date(_DateTime), DT2Time(_DateTime) + 5000);
                    while (CurrentDateTime() < _DateTime) do
                        Sleep(1000);
                end;
            }
        }
    }
    trigger OnOpenPage();
    begin
        Message('App published: Hello world');
    end;

}

I published it and let’s see if it is captured by Performance Profiler.

As the documentation recommended, I opened the Performance Profiler in its own page.

On the Business Central main browser window go to the Customer List and locate the new action:

On the Performance Profiler, click on the Start action.

Then launch the TestProfiler action.

When you get control to the main browser BC page, head over the Performance Profiler page and click Stop action. And here are the results:

We can see 2 regions:

  • one that shows what application extensions were detected between Start and Stop.
  • a second one, a technical part-page, with 2 sub-lists:
    • one showing the time spent by application object
    • second showing a call tree with timing for each branch

Very cool feature which I wish I had it in all previous BC versions.

How was this designed?

The main page Performance Profiler is based on Page 24 “Performance Profiler” in the Microsoft System Application.

Lots of other objects involved with the Performance Profiler to bring this new feature:

Take a look below, to compare the Microsoft System 19.5 versus Microsoft System 20.

With BC 2022 wave 1, the system application comes with a set of new objects to support Profiling.

All in all, Performance Profiler is a great addition to the Business Central platform.

This will help consultants locate faulty/slow code and record, download and send the recording to the authors of the code that performs poorly.

One response to “Say Hello to the new “Performance Profiler””

  1. […] Source : Business Central Musings Read more… […]

Leave a Reply

%d bloggers like this: