Home Learning Paths ECU Lab Assessments Interview Preparation Arena Pricing Log In Sign Up

TRACE32 OS-Aware Runtime Statistics

TRACE32multicore_profiling.cmm
/* Load ORTI for both cores */
TASK.ORTI "output/OsOrti_Core0.orti" CORE 0
TASK.ORTI "output/OsOrti_Core1.orti" CORE 1

/* Enable runtime measurement — ETM trace required */
TASK.RTMSTAT.RESET
Go
WAIT 1.s   /* collect 1 second of data */
TASK.RTMSTAT

/* Expected output columns:
   Task Name              | Core | Net (us) | Net% | Gross (us) | Preemptions
   Task_SafetyCtrl_10ms   |  0   |  3420    | 34%  |  3850      |  12
   Task_ComStack_1ms      |  1   |  9100    | 91%  |  9240      |  8
   Task_ADAS_50ms         |  1   |  4200    | 42%  |  5100      |  6
   ISR_Can0_Rx            |  0   |  1500    | 15%  |  1500      |  0

   → Core 0 at 72% (OK), Core 1 at 91% (near limit!)
   → Task_ComStack_1ms dominates Core 1 */

Imbalance Identification & Task Migration Feasibility

When one core exceeds 80% utilisation, candidate tasks for migration to the less-loaded core must be evaluated for IOC overhead, spinlock contention, and BSW module affinity constraints.

Migration CandidateNet Time (µs)IOC Channels AddedBSW ConstraintVerdict
Task_ADAS_50ms (Core 1 → Core 0)42002 channels (sensor in, command out)No BSW affinity constraintFeasible — moves 42% load off Core 1
Task_ComStack_1ms (Core 1 → Core 0)9100CanIf must move with COMCanIf owns CAN controller on Core 1Not feasible — would break peripheral ownership
DCM_MainFunction split (no migration)3000DCM singleton on Core 0Reduce DCM period 5ms → 10ms; saves 0.3% on Core 0

CAN Rx ISR Load: Deferred Processing Pattern

CCanIsr_Deferred.c
/* Problem: ISR_Can0_Rx consuming 15% on Core 0 under peak bus load */
/* Solution: deferred processing via IOC notification flag */

/* In the CAN Rx ISR (Core 0, minimal work): */
ISR(CanIsr_Core0_Rx)
{
    /* Minimal: copy raw frame to IOC double-buffer */
    Can_RawFrame_t frame;
    Can_GetControllerRxData(CAN_CONTROLLER_0, &frame);
    Ioc_Send_RawCanFrame(&frame);    /* IOC send to Core 1 task */
    /* ISR done — no COM processing in interrupt context */
}

/* In Task_ComStack_1ms on Core 1 (deferred, full COM processing): */
TASK(Task_ComStack_1ms)
{
    Can_RawFrame_t frame;
    while (Ioc_Receive_RawCanFrame(&frame) == IOC_E_OK) {
        /* Full CanIf → PduR → COM chain here */
        CanIf_ProcessRxFrame(&frame);
    }
    Com_MainFunctionRx();
    Com_MainFunctionTx();
    TerminateTask();
}

Period Tuning & TA Revalidation

BSW Main FunctionDefault PeriodRelaxed PeriodCPU Saving (Core 1)AUTOSAR Spec Limit
Dem_MainFunction5 ms10 ms0.6% on Core 110 ms max per SWS_Dem
CanSM_MainFunction5 ms10 ms0.4% on Core 110 ms typical
NvM_MainFunction5 ms100 ms0.8% on Core 0No strict limit; fee write latency increases
Dcm_MainFunction5 ms10 ms0.3% on Core 010 ms; P2 server timer still met

💡 Always Re-Run TA Analysis

Every period change must be revalidated in the Timing Architects model. A 10ms Dem_MainFunction period is permitted by the SWS but may violate a project-specific DEM event debounce timing requirement. Document the timing rationale in the software integration specification and confirm with the TA analysis before finalising.

Summary

Performance analysis on multi-core AUTOSAR systems requires per-core profiling — aggregate CPU load figures hide the real picture. The deferred ISR processing pattern is the standard solution for high-frequency CAN Rx ISR load. Every task migration decision must be checked against BSW module affinity and peripheral ownership constraints before being implemented, and revalidated with a full schedulability analysis.

🔬 Deep Dive — Core Concepts Expanded

This section builds on the foundational concepts covered above with additional technical depth, edge cases, and configuration nuances that separate competent engineers from experts. When working on production ECU projects, the details covered here are the ones most commonly responsible for integration delays and late-phase defects.

Key principles to reinforce:

  • Configuration over coding: In AUTOSAR and automotive middleware environments, correctness is largely determined by ARXML configuration, not application code. A correctly implemented algorithm can produce wrong results due to a single misconfigured parameter.
  • Traceability as a first-class concern: Every configuration decision should be traceable to a requirement, safety goal, or architecture decision. Undocumented configuration choices are a common source of regression defects when ECUs are updated.
  • Cross-module dependencies: In tightly integrated automotive software stacks, changing one module's configuration often requires corresponding updates in dependent modules. Always perform a dependency impact analysis before submitting configuration changes.

🏭 How This Topic Appears in Production Projects

  • Project integration phase: The concepts covered in this lesson are most commonly encountered during ECU integration testing — when multiple software components from different teams are combined for the first time. Issues that were invisible in unit tests frequently surface at this stage.
  • Supplier/OEM interface: This is a topic that frequently appears in technical discussions between Tier-1 ECU suppliers and OEM system integrators. Engineers who can speak fluently about these details earn credibility and are often brought into critical design review meetings.
  • Automotive tool ecosystem: Vector CANoe/CANalyzer, dSPACE tools, and ETAS INCA are the standard tools used to validate and measure the correct behaviour of the systems described in this lesson. Familiarity with these tools alongside the conceptual knowledge dramatically accelerates debugging in real projects.

⚠️ Common Mistakes and How to Avoid Them

  1. Assuming default configuration is correct: Automotive software tools ship with default configurations that are designed to compile and link, not to meet project-specific requirements. Every configuration parameter needs to be consciously set. 'It compiled' is not the same as 'it is correctly configured'.
  2. Skipping documentation of configuration rationale: In a 3-year ECU project with team turnover, undocumented configuration choices become tribal knowledge that disappears when engineers leave. Document why a parameter is set to a specific value, not just what it is set to.
  3. Testing only the happy path: Automotive ECUs must behave correctly under fault conditions, voltage variations, and communication errors. Always test the error handling paths as rigorously as the nominal operation. Many production escapes originate in untested error branches.
  4. Version mismatches between teams: In a multi-team project, the BSW team, SWC team, and system integration team may use different versions of the same ARXML file. Version management of all ARXML files in a shared repository is mandatory, not optional.

📊 Industry Note

Engineers who master both the theoretical concepts and the practical toolchain skills covered in this course are among the most sought-after professionals in the automotive software industry. The combination of AUTOSAR standards knowledge, safety engineering understanding, and hands-on configuration experience commands premium salaries at OEMs and Tier-1 suppliers globally.

← PreviousSpinlocks & Shared Resource ManagementNext →Hands-On: Dual-Core ECU Project