Skip to main content
Open topic with navigation CAPL Functions » General » Function Overview » CAPLProfiler::Stop

CAPLProfiler::Stop

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

Function Syntax

long CAPLProfiler::Stop();

Description

Stops the time measurement of the profiler. Stop() must be 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.
  • -1: Profiler is not running (Start was not called).

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);
}
StartReset • GetAverageCallTimeNS