Performance profiler
Last update: 19.09.2025Introduction
The Simulation Framework provides a built-in performance profiler, which can help measure the CPU resources consumed by each of your activities for a particular simulation run.
Use cases for the profiler:
- Measure the performance for specific environments and scenario executions
- Measure the impact of features being added or removed in user defined activities and/or fmus
- Compare two versions of activities
Enable and configure profiler
Based on the configuration, the data is either logged in the .log files or sent out to the opentelemetry collector endpoint.
Basic configuration
Add the following configuration to the simulation_scheduling section of your configuration file:
[1] To produce text based logs:
{
"sim_instance_name": "test_simulation_instance",
"profiler":
{
"enabled": true
},
[2] To send metrics to your active opentelemetry collector endpoint:
{
"sim_instance_name": "test_simulation_instance",
"profiler":
{
"enabled": true,
"otlp_endpoint": "127.0.0.1:4318"
},
"activities": [
Configuration parameters
The profiler section contains the following parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | Enables or disables the profiler, false if not specified. |
otlp_endpoint | string | No | Opentelemetry collector endpoint. Refer: Example configuration |
- The profiler produces text based logs in the configured
output_directorybased on the configuration. - If the opentelemetry endpoint configured is of incorrect format then the profiler will produce text based logs.
- If the
profilersection is missing in thesimulation_schedulingorenabledflag is set tofalsethen the profiler stays disabled. - If the
opentelemtry endpointis unreachable an error will be thrown in the CLI output. Please make sure the endpoint is ready and active before running the simulation. Refer: Troubleshooting
Profiler behavior
- Initialisation: All activities from simulation configuration are identified for profiling.
- Collect Telemetry Data: Accumulate CPU usage times for each of the activities in the configuration during the run.
- Report: CPU usage times for respective activities are reported either via text based logs or opentelemetry metrics based on your configuration.
Example configuration
Here's a complete Simfwk configuration example:
{
"simulation_parameters": {
"input_open_scenario": "../common/data/scenario/simple_cut_in.xosc",
"input_user_settings": "../common/data/gtgen_usersettings/UserSettings.ini",
"output_directory": "sim_output",
"job_id": "autonomy_my_tpm_example"
},
"simulation_scheduling": {
"sim_instance_name": "my_tpm_instance",
"profiler":
{
"enabled": true,
"otlp_endpoint": "localhost:4318"
},
"activities": [
{
"name": "groundtruth_generator_activity",
"is_primary_activity": true,
"topics_cycling_info": [
{
"topic_id": "__all__",
"topic_cycle_time_in_ms": 500
}
],
"type": "built-in"
},
{
"name": "my_tpm_activity",
"depends_on": ["groundtruth_generator_activity"],
"type": "standalone"
},
{
"name": "kpi_evaluator_activity",
"depends_on": ["groundtruth_generator_activity"],
"type": "built-in"
},
{
"name": "kpi_logger_activity",
"depends_on": ["kpi_evaluator_activity"],
"type": "built-in"
}
]
}
}
Troubleshooting
- If your Opentelemetry metrics are not received and you see errors in the
simfwk_clilogs as shown below, this means your opentelemetry endpoint is not accessible. Please check your connections.
[Error] File: external/opentelemetry-cpp~/exporters/otlp/src/otlp_http_client.cc:213 [OTLP HTTP Client] Session state: connection failed.Failed to connect to localhost port 4318 after 0 ms: Couldn't connect to server
[Error] File: external/opentelemetry-cpp~/exporters/otlp/src/otlp_http_metric_exporter.cc:203 [OTLP METRIC HTTP Exporter] ERROR: Export 3 metric(s) error: 1