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

CAPLProfiler::GetLastCallTimeNS

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

Function Syntax

qword CAPLProfiler::GetLastCallTimeNS();

Description

Returns the last time for a measured profiler call (i.e., time between Start and Stop) in nanoseconds. If there are no measurements yet, returns 0.

Parameters

Return Values

  • 0: No measurements yet.
  • > 0: Last time measured.

Example

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

  MyFunction();

  profiler.Stop();
  TimeToString(profiler.GetLastCallTimeNS(), lastTimeString);
  TimeToString(profiler.GetMaximumCallTimeNS(), maxTimeString);
  Write("MyFunction execution time: %s last time, %s maximum", lastTimeString, maxTimeString);
}
StartStopReset