Main Content

startProfiler

Start profiling service on target computer

Since R2020b

Description

startProfiler(target_object,app_name) starts the profiler on the Speedgoat® target computer. You can start the profiler before or after you load the real-time application on the target computer. Before you start the application, you must start the profiler.

The startProfiler function affects the value of the target_object property ProfilerStatus.

  • Ready status indicates that the target_object exists, no profiling data is available, and the startProfiler function has not been called.

  • StartRequested status indicates that the target_object exists, no profiling data is available, the startProfiler function has started the profiler, and the real-time application is not loaded.

  • Running status indicates that the target_object exists, profiling data is being collected, the startProfiler function has started the profiler, and the real-time application is loaded and running.

  • DataAvailable status indicates that the target_object exists, profiling data is available, and the real-time application and the profiler have stopped.

When the profiler starts and stops, there is an increase in task execution time (TET) that can cause a CPU overload condition. If using profiler causes CPU overload, you can increase the sample time in order to use the profiler.

example

Examples

collapse all

Build the real-time application slrt_ex_mds_and_tasks. Load the real-time application. Start the profiler. Start the application.

tg = slrealtime;
mdlSTF = getSTFName(tg);
mdlName = 'slrt_ex_mds_and_tasks';
mdlNameSub1 = 'slrt_ex_mds_subsystem1';
mdlNameSub2 = 'slrt_ex_mds_subsystem2';
openExample(mdlName);
open_system(mdlNameSub1);
open_system(mdlNameSub2);
set_param(mdlName,"SystemTargetFile",mdlSTF);
set_param(mdlNameSub1,"SystemTargetFile",mdlSTF);
set_param(mdlNameSub2,"SystemTargetFile",mdlSTF);
slbuild(mdlName);
load(tg,mdlName);
startProfiler(tg);

% start profiler before starting application

start(tg);

Build the real-time application slrt_ex_mds_and_tasks. Load the application. Check the profiler status from the target object property ProfilerStatus.

  1. tg = slrealtime;
    mdlSTF = getSTFName(tg);
    mdlName = 'slrt_ex_mds_and_tasks';
    mdlNameSub1 = 'slrt_ex_mds_subsystem1';
    mdlNameSub2 = 'slrt_ex_mds_subsystem2';
    openExample(mdlName);
    open_system(mdlNameSub1);
    open_system(mdlNameSub2);
    set_param(mdlName,"SystemTargetFile",mdlSTF);
    set_param(mdlNameSub1,"SystemTargetFile",mdlSTF);
    set_param(mdlNameSub2,"SystemTargetFile",mdlSTF);
    slbuild(mdlName);
    load(tg,mdlName);
    tg.ProfilerStatus
    ans =
    
        'Ready'
  2. Start the profiler, and then start the application.

    startProfiler(tg);
    
    % start profiler before starting application
    
    start(tg);
  3. After the application stops, check the profiler status.

    tg.ProfilerStatus
    ans =
    
        'DataAvailable'

Input Arguments

collapse all

Provides access to methods that manipulate the target computer properties.

Example: tg

Provides name of real-time application MLDATX file that you built from the model.

Example: 'slrt_ex_osc'

Version History

Introduced in R2020b