ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
Timer Class Reference

This is the base class for generating objects that can time interval consecutively.
More...

Inheritance diagram for Timer:
Collaboration diagram for Timer:

Public Member Functions

function Timer ()
 Return a scalar object of class pm.timing.Timer.
More...
 
function tic (in self)
 Reset the timer, equivalent to reconstructing the timer object.
This is a dynamic method of the class pm.timing.Timer. More...
 
function toc (in self)
 Return a scalar MATLAB real containing the time past since the (re)construction of the timer object.
More...
 
function del (in self)
 Return a scalar MATLAB real containing the time past since the last time measurement by the timer object.
Also, set the clock attribute of the parent object.
This is a dynamic method of the class pm.timing.Timer.
More...
 

Data Fields

Property start
 

Protected Attributes

Property clock
 

Detailed Description

This is the base class for generating objects that can time interval consecutively.

The main utility of this timer class is its dynamic del() method which can compute the time elapsed since the last measurement in one function call.

Developer Remark:
The handle superclass is essential to allow object modification by the object methods.
Note
See the documentation of the class constructor.
See below for information on the attributes (properties).
See below for information on the methods.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Joshua Alexander Osborne, May 21 2024, 5:47 AM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin

Definition at line 30 of file Timer.m.

Constructor & Destructor Documentation

◆ Timer()

function Timer::Timer ( )

Return a scalar object of class pm.timing.Timer.

This is the constructor of the class pm.timing.Timer.

Returns
self : The output scalar object of class pm.timing.Timer.


Possible calling interfaces

self = pm.timing.Timer()


Example usage

1cd(fileparts(mfilename('fullpath'))); % Change working directory to source code directory.
2addpath('../../../'); % Add the ParaMonte library root directory to the search path.
3
4pm.matlab.show()
5pm.matlab.show('timer = pm.timing.Timer();')
6 timer = pm.timing.Timer();
7pm.matlab.show('timer.tic(); % reset/start timer.')
8 timer.tic(); % reset/start timer.
9pm.matlab.show('pause(1);')
10 pause(1);
11pm.matlab.show('timer.toc()')
12pm.matlab.show( timer.toc() )
13pm.matlab.show('pause(.5);')
14 pause(.5);
15pm.matlab.show('timer.toc()')
16pm.matlab.show( timer.toc() )
17pm.matlab.show('pause(.2);')
18 pause(.2);
19pm.matlab.show('timer.del()')
20pm.matlab.show( timer.del() )
Property start
Definition: Timer.m:56
function root()
Return a scalar MATLAB string containing the root directory of the ParaMonte library package.

Example output
1
2timer = pm.timing.Timer();
3timer.tic(); % reset/start timer.
4pause(1);
5timer.toc()
6 1.001740000000000
7pause(.5);
8timer.toc()
9 1.502718000000000
10pause(.2);
11timer.del()
12 0.201646000000000


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Joshua Alexander Osborne, May 21 2024, 5:49 AM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin

Member Function Documentation

◆ del()

function Timer::del ( in  self)

Return a scalar MATLAB real containing the time past since the last time measurement by the timer object.
Also, set the clock attribute of the parent object.
This is a dynamic method of the class pm.timing.Timer.

Returns
delta : The output scalar MATLAB real containing the time past since the last time measurement by the timer object.


Possible calling interfaces

timer = pm.timing.Timer()
delta = timer.del()


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Joshua Alexander Osborne, May 21 2024, 5:59 AM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin

◆ tic()

function Timer::tic ( in  self)

Reset the timer, equivalent to reconstructing the timer object.
This is a dynamic method of the class pm.timing.Timer.


Possible calling interfaces

timer = pm.timing.Timer()
timer.tic()


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Joshua Alexander Osborne, May 21 2024, 5:50 AM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin

◆ toc()

function Timer::toc ( in  self)

Return a scalar MATLAB real containing the time past since the (re)construction of the timer object.

Also, set the clock attribute of the parent object.
This is a dynamic method of the class pm.timing.Timer.

Returns
clock : The output scalar MATLAB real containing the time past since the (re)construction of the timer object.


Possible calling interfaces

timer = pm.timing.Timer()
clock = timer.toc()
Property clock
Definition: Timer.m:44


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Joshua Alexander Osborne, May 21 2024, 5:58 AM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin

Field Documentation

◆ clock

Property Timer::clock
protected

clock

The scalar MATLAB real containing the most recent timing since the construction of the timer.

Definition at line 44 of file Timer.m.

◆ start

Property Timer::start

start

The scalar MATLAB real containing the timer start.

Definition at line 56 of file Timer.m.


The documentation for this class was generated from the following file: