RRcputime

by Christian Dietz, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
, Creation date: 2017-03-09, Last change: 2025-09-14

returns realtime difference and cputime difference since first call

Description

If Matlab works with 100% CPU time, tic time and CPU time are identical. Nevertheless, is makes sense also to check the Realtime in realtime systems :-)

See Also: RRrun

Example Illustration

 missing image of RRcputime(RRtictime)

Syntax

[t,tc]=RRcputime([RRtictime])

Input Parameter

RRtictime: only used for reset by tic

Output Parameter

t: time difference since first call
tc: CPUtime difference since first call

This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, RRcputime, is designed to measure the real-time and CPU time differences since its first call. It is part of the SG-Library and was created by Christian Dietz in 2017.

Input Parameters

Output Results

Algorithm Explanation

The function uses persistent variables RRtictime and RRcputime to store the initial time values. If an input argument is provided, it resets these variables using the input value for RRtictime and the current CPU time for RRcputime.

If RRtictime is empty, it initializes RRtictime with the current time using tic, sets t and tc to zero, and updates RRcputime with the current CPU time.

If RRtictime is not empty, it calculates the elapsed time t using toc(RRtictime). If a second output is requested, it calculates tc as the difference between the current CPU time and RRcputime.

Algorithm explaination created using ChatGPT on 2025-08-19 01:32. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21