How to create a long profiler with enough data for analysis

The goal of creating a long profiler is to include at least two (2x) calls of the slowest configured and used task class, as shorter profilers may not accurately reflect the CPU usage of the PLC. For example, if the slowest task class with programs is TC#5 at 200ms, then the profiler should extend at least 400ms. In general, the longer the profiler the better diagnostic information that can be obtained, but this should be balanced with PLC resources used by the profiler. The profiler configuration sets the buffer for the number of events, so the amount of time recorded will depend on the project. The profiler defaults are set to use a small amount of resources, as to not overwhelm older and more budget friendly PLCs.

The profiler can be made more verbose by including the logging of specific libraries (see Library Logging section).


  1. Connect with Automation Studio to the PLC and open the Profiler (Open > Profiler).

  2. Uninstall the current profiler.

  3. Click the Configuration button to open the configuration dialog

  4. Make the following changes under the General tab:

Transfer profiler configuration object to => USRROM
Generate profiler data object in => USRRAM (or DRAM if no/not enough USRRAM is available, see below)

  1. Make the following changes under the Buffer tab:

Number of recording entries => 15000 (The PLC may not have enough SRAM for the number of configured entries. DRAM can be used as a potential substitute depending on the error)
Buffer for created tasks => 50
Buffer for created user tasks => 30

If a more verbose profiler is necessary, follow the instructions under the Library Logging section below.

  1. Click OK to accept and close the Configuration dialog.

  2. Click the Install button to install the profiler onto the PLC.

The next step is to test the profiler configuration to determine if the buffer amount is sufficient, and increase the number of entries if necessary.

  1. Ensure the PLC is in RUN mode and wait 10+ seconds.

  2. Click the Stop button within the profiler window. This will stop the current profiler and make the data available for upload.

  3. Click the Upload Data Object button within the profiler window.

If there are archived error profilers on the PLC, then you will be asked to select the profiler data object to upload. Choose “prfmod$f” and click OK.

  1. Change to the Table view (orange arrow), then note the Profiler Run Time in us. If the time does not cover at least twice (2x) the longest used cycle time, increase the “Number of recording entries” in the Profiler configuration (see Step 5).

In the above example, the profiler ran for 1,029,341.038 us, which is a little more than 1s.

  1. Click the Start button to restart the profiler.

Since the configuration is saved into the USERROM, the profiler will remain through power cycles and online transfers. Offline installation or initial installation transfers will clear the profiler configuration.


:+1: for the short and concise summary

I would add some more points to verify if the configuration was set correctly:

Check call count

In addition of checking the recording time of the profiler, you can also check the call count of the slowest task class. As mentioned by @andrew.kelley it should be at least 2, but probably better 3-4.

No unknown tasks

It is also very important to make sure, that there are no unknown cyclic or non-cyclic tasks. If there are unknown tasks, you have to increase the values Buffer for created tasks and Buffer for created user tasks in the configuration.

Verify on the real system

It is important to verify the recording configuration on the real system / project / machine on which the profiler will be running. For bigger projects with many programs the required buffer sizes will be much bigger than for small projects.


Thanks for this valuable contribution. Check out the following tutorial on the B&R Tutorial Portal.

Tutorial: “Performance measurement in the Profiler

More tutorials you can get here: B&R Tutorial Portal

You can use the following login credentials for accessing the B&R tutorial:

Username: Automation
Password: Academy1

More learning and teaching materials and trainings as well can be seen on the Automation Academy landing page:

BR Hubert

1 Like

Thanks for that very good summary :+1:

In some cases, it could be helpful to setup the profiler by own code inside the project, e.g. if you want to have a own configuration active even after initial installation, or if you want to ensure that your own configuration is running (again) after every reboot.

This can be done relativly easy by calling the function blocks of the AsArProf - Library in the following sequence inside a INIT program of a task.
(I personally recommend to do this in the first task of task class #1 to get as many profiler information as possible even while the INIT phase of the PLC)

Step 1 - call “LogStop” to stop a possibly running profiler (e.g. the default configuration after initial installation)
Step 2 - call “LogDeInstall” to remove the existing profiler configuration
Step 3 - call “LogInstall” to add your configuration with the parameters you want to use
Step 4 - call “LogStart” to enable this configuration and start the logger
Step 5 - (optional) call “LogStateGet” to ensure that your profiler configuration is running

The AsArProf library is a powerful diagnostic library. However if the application desire is to simply use a configured profiler on each startup, even after project transfers and initial/offline installation, then I would recommend uploading the profiler configuration into the Automation Studio project instead.

Following the steps in the guide above, perform the following to save the modified profiler configuration into the project.
1) Connect to the PLC.
2) Use the top menu Online, and select Compare > Software.
3) Scroll down to the Diagnosis Objects section and find the ‘prfmod$e’ object.
4) Right click the ‘prfmod$e’ object, and select Online > Load from Target.
5) This will place the profiler configuration within the Configuration View of your project, and subsequent builds will include the profiler configuration during download/installation.

The profiler configuration can be shared between projects/configurations, but care should be given to the amount of USERRAM/DRAM available and location of the profiler data object as the PLC changes between configurations. The most complex machine configuration may warrant a different profiler configuration than the simplest.

1 Like