Skip navigation
embos-product-icon.svg

embOS µsec Precise System Time

Use highly accurate timings with embOS.

embOS supports run-time measurements that may be used for calculating the execution time of any section of user code.

embOS offers the API function OS_GetTime_us() to retrieve the current system time in micro second resolution. This feature is easy to use and can be utilized with any embOS start project. An application merely needs to set up this feature with a simple API call to OS_Config_SysTimer(). This was already done for most embOS start projects, and may swiftly be done for any further embOS start project on request.

void MyFunction(void) {
  OS_U32 tStart;
  OS_U32 tEnd;
  OS_U32 t;

  tStart = OS_GetTime_us();
  DoSomeThing()
  tEnd = OS_GetTime_us();
  t = tEnd - tStart;
  printf("Time to run the function: %u", t);
}