Main Content

generateReport

Create report of data from profiling simulation run using Simulink Profiler

Since R2023a

    Description

    generateReport(profilingData) creates an HTML report of the profiling results profilingData generated by profiling the execution of a model using the Simulink Profiler. The HTML report is saved in the current working directory with a filename based on the name of the model and the timestamp of the profiling simulation that created the profiling results.

    example

    generateReport(profilingData,filename) creates an HTML report of the profiling results profilingData and saves the report using the path and filename filename.

    Examples

    collapse all

    Open the model vdp.

    mdl = "vdp";
    open_system(mdl)

    Use the sim function to run a profiling simulation of the model using the Simulink Profiler.

    out = sim(mdl,"Profile","on");

    Get the profiling results from the simulation metadata in the Simulink.SimulationOutput object out.

    profilingData = out.SimulationMetadata.TimingInfo.ProfilerData;

    Use the generateReport function to create an HTML report of the profiling results. Save the report in the current working directory with the filename vdpProfilingResults.

    profilerReportName = "MyModelProfilingResults.html";
    generateReport(profilingData,profilerReportName)

    Open the HTML report.

    open(profilerReportName)

    Input Arguments

    collapse all

    Profiling simulation results, specified as a Simulink.profiler.Data object.

    To create a Simulink.profiler.Data object, profile the execution time for your model using the Simulink Profiler. The profiling simulation results are returned as a Simulink.SimulationOutput object. The SimulationMetadata property of the SimulationOutput object contains complete simulation metadata, including the profiling results.

    Access the Simulink.profiler.Data object that contains the profiling results through the TimingInfo property of the SimulationMetadata object, which contains a structure with fields that summarize information about the simulation execution time. The ProfileData field of the TimingInfo structure contains the Simulink.profiler.Data object.

    This code shows how to run a profiling simulation programmatically using the sim function and then access the Simulink.profiler.Data object that contains the profiling data.

    out = sim("MyModel","Profile","on");
    profilingData = out.SimulationMetadata.TimingInfo.ProfilerData;

    Path and name for HTML file, specified as a string or a character vector.

    When you want to save the report in the current working directory, you can specify only a filename.

    Example: generateReport(profilingData,"C:/Documents/Profiling Reports/modelNameProfilngResults") saves the profiling report in the directory C:/Documents/Profiling Reports with the name modelNameProfilingResults.

    Example: generateReport(profilingData,"modelNameProfilingResults") saves the profiling report in the current working directory with the name modelNameProfilingResults.

    Data Types: char | string

    Version History

    Introduced in R2023a