Skip to main content

Documentation Index

Fetch the complete documentation index at: https://notevil.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Open topic with navigation CAPL Functions » General » Function Overview » CAPLProfiler::Start

CAPLProfiler::Start

Valid for: CANoe DE • CANoe:lite DE • CANoe4SW DE • CANoe4SW:lite DE

Function Syntax

long CAPLProfiler::Start();

Description

Starts the time measurement of the profiler. It will run until Stop() has been called as many times as Start() has been called. Then the measured time is used to update the statistics of the profiler.

Parameters

Return Values

  • 0: Success
  • > 0: Profiler was already running. You will need to call Stop once for each Start call.

Example

void MyFunctionProfiler()
{
  CAPLProfiler profiler;
  char avgTimeString[20]; char maxTimeString[20];
  profiler.Start();

  MyFunction();
  
  profiler.Stop();
  TimeToString(profiler.GetAverageCallTimeNS(), avgTimeString);
  TimeToString(profiler.GetMaximumCallTimeNS(), maxTimeString);
  Write("MyFunction execution time: %s on average, %s maximum", avgTimeString, maxTimeString);
}
StopRest • GetAverageCallTimeNS