classdef TimingAnalyzer< handle
% TimingAnalyzer class estimates the execution time metric of code path and annotates the
% longest path in the Simulink model
%
% Properties:
% ------------------------------------------------------------------
% TestFile          : Full file path to Simulink test file (.mldatx).
%                     Inputs specified in the test file are used
%                     for measuring execution-time metric. Hence, inputs
%                     providing high model coverage are desirable.
%
% SimMode           : Simulation mode for profiling the generated code to
%                     measure execution-time metrics.
%                     Default value is SIL.
%
% CostModel         : Setting to select the processing type of execution-time metrics.
%                     Possible value is either 'AverageCase' or 'WorstCase'.
%                     Default value is 'AverageCase'.
%
% SegmentSize       : Code segment size to be considered for static analysis.
%                     Default value is 0. i.e., all statements except basic blocks are
%                     instrumented
%
% Methods:
% ------------------------------------------------------------------
% generateTests     : Generates inputs for model coverage by using
%                     Simulink Design Verifier.
%
% measureCost       : Measures execution-time of generated code
%                     by profiling in SIL/PIL simulation.
%
% analyzePath       : Analyze model for maximum-execution-time path
%
%
% Usage:
% ------------------------------------------------------------------
% Example 1:
% obj = coder.TimingAnalyzer('modelName');
% obj.generateTests();
% obj.measureCost();
% results = obj.analyzePath();
% Inputs are generated from Simulink Design Verifier.
%
% Example 2:
% obj = coder.TimingAnalyzer('modelName');
% obj.SimMode = 'PIL';
% obj.TestFile = 'input.mldatx';
% obj.measureCost();
% results = obj.analyzePath();
% Inputs are extracted from custom test file. The model performs PIL
% simulation for measuring execution-time of the generated code.
%
% Example 3:
% obj = coder.TimingAnalyzer('modelName');
% obj.SimMode = 'SIL';
% obj.measureCost();
% results = obj.analyzePath();
% Inputs are already mapped in the model.

 
% Copyright 2022-2023 The MathWorks, Inc.

    methods
        function out=TimingAnalyzer
        end

    end
    properties
        % Setting for the code segment cost model
        CostModel;

        % Setting for the code segment size
        SegmentSize;

        % Simulation mode for profiling the generated code
        SimMode;

        % Full file path to Simulink test file (.mldatx)
        TestFile;

    end
end
