IGLib
1.7.2
The IGLib base library for development of numerical, technical and business applications.
|
Timer for measuring execution times and other intervals of time elapsed between successive events. $A Igor xx Apr10 Jun15; More...
Public Member Functions | |
StopWatch1 () | |
StopWatch1 (string label) | |
double | ThreadCpuTime () |
Returns the total CPU time sent up to this moment by the current process. More... | |
void | Start () |
Starts the timer (the elapsed time and CPU time are measured since this moment). If the timer is already running then exception is thrown. More... | |
void | Stop () |
Stops the timer and adds the time and CPU time difference measured in the last round to the total time. If the timer is not running then exception is thrown. More... | |
void | Reset () |
Resets the timer. Its state becomes identical to the state right after creation (as it has not been used before). More... | |
void | SetTimeStamp () |
Sets the timestamp on the timer (marks the current time). This is done automatically by Reset(), Create() and constructors. More... | |
void | SetLabel (string label) |
override string | ToString () |
string | ToStringLong () |
delegate void | VoidDelegate () |
Static Public Member Functions | |
static StopWatch1 | Create () |
static StopWatch1 | Create (string label) |
static TimeSpan | GetTimeSpan (double seconds) |
Gets a timespan object that is equivalent to the specified time in seconds, and returns it. More... | |
static void | Example () |
Example of using the stopwatch. More... | |
static int | TestExecutionTime (VoidDelegate work, out double averageExecutionTime, out double averageCpuTime, double targetedTime=0.1, int outpuLevel=0, int numInitialExecutions=1) |
Static Public Attributes | |
static int | MaxWarnCpu = 0 |
Protected Member Functions | |
void | Init () |
void | Init (string label) |
void | Warning (string warningstr) |
Prints out a warning related to timer use. More... | |
Protected Attributes | |
readonly object | _lock = new object() |
Lock object to be used for locking the current object. More... | |
string | _label = null |
int | _ID = 0 |
double | _creationcCpuTime |
DateTime | _creationTime |
double | _totalTime |
bool | _running = false |
Static Protected Attributes | |
static int | lastId = 0 |
static int | numWarnCpu = 0 |
Properties | |
static object | StaticLock [get] |
Static lock object accessible only from the current class. More... | |
object | Lock [get] |
Lock object to be used for locking the current object. More... | |
bool | IsRunning [get] |
Returns a flag indicating whether the stopwatch is currently running. More... | |
int | Id [get] |
Returns counter's ID. More... | |
DateTime | TimeStamp [get] |
Gets the data from time stamp contained in the timer. More... | |
string | Label [get] |
double | TotalTime [get] |
Gets the total time in seconds, measured by the timer up to the current moment. If the timer is running then the current absolute time is calculated, and difference with the last starting time added to the total time accumulated in previous rounds. More... | |
double | TotalCpuTime [get] |
Gets the total CPU time in seconds, measured by the timer up to the current moment. If the timer is running then the current CPU time is calculated, and difference with the last starting CPU time added to the total CPU time accumulated in previous rounds. More... | |
double | Time [get] |
Returns the elapsed time measured by the timer in the last round. If the timer is running then the current time is calculated and its difference with the starting time returned. More... | |
double | CpuTime [get] |
Returns the elapsed CPU time measured by the timer in the last round. If the timer is running then the current CPU time is calculated and its difference with the starting time returned. More... | |
TimeSpan | TimeSpan [get] |
TimeSpan | CpuTimeSpan [get] |
TimeSpan | TotalTimeSpan [get] |
TimeSpan | TotalCpuTimeSpan [get] |
Properties inherited from IG.Lib.ILockable | |
object | Lock [get] |
Properties inherited from IG.Lib.IIdentifiable | |
int | Id [get] |
Returns unique ID (in the scope of a given type) of the current object. More... | |
Private Attributes | |
double | _totalCpuTime |
double | _startCpuTime |
double | _stopCpuTime |
double | _firstStartCpuTime |
DateTime | _startTime |
DateTime | _stopTime |
DateTime | _firstStartTime |
bool | _used = false |
bool | _measureTime = true |
bool | _measureCpuTime = true |
Static Private Attributes | |
static object | _staticLock |
Timer for measuring execution times and other intervals of time elapsed between successive events. $A Igor xx Apr10 Jun15;
|
inline |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inlinestatic |
|
inlinestatic |
|
inline |
Returns the total CPU time sent up to this moment by the current process.
|
inlineprotected |
Prints out a warning related to timer use.
warningstr |
|
inline |
Starts the timer (the elapsed time and CPU time are measured since this moment). If the timer is already running then exception is thrown.
Referenced by IG.Lib.WaitFileEventLatenceBase.ExampleLatence.AlternateCreateRemoveExample(), IG.Crypto.CryptoManager.AppAsymTest(), IG.Crypto.CryptoManager.AppEncryptSymmetricAll(), IG.Num.SimKosecFileManagerBase.CalculateVectorResponse(), IG.Neural.NeuralAllpicationCommands.CmdTestJson(), IG.Neural.NeuralAllpicationCommands.cmdTestSerializationNeural(), IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvReadDefinitionAndData(), IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvWriteDefinitionAndData(), IG.Lib.StopWatch1.Example(), IG.Lib.RealFunctionLoader.Example(), IG.Lib.ScalarFunctionLoader.Example(), IG.Gr3d.TestVtkGraphicBase.ExampleCellsGridContours(), IG.Gr3d.TestVtkGraphicBase.ExampleCellsGridEfficient(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.ExampleClosestPointsDummy(), IG.Lib.UtilSystem.ExampleCopyDir(), IG.Gr3d.TestVtkGraphicBase.ExampleQuadCells(), IG.Gr3d.TestVtkGraphicBase.ExampleStructuredGrid(), IG.Lib.CommandLineApplicationInterpreter.ExitRepeatBlock(), IG.Script.LoadableScriptShellNeuralBase.ParSimRunJob(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.PrintNeighborDistanceStatistics(), IG.Lib.CommandLineApplicationInterpreter.RunRepeat(), IG.Script.LoadableScriptShellNeuralBase.TestAnalysis(), IG.Script.LoadableScriptShellNeuralBase.TestAnalysisTable(), IG.Script.LoadableScriptShellNeuralBase.TestApproximation(), IG.Script.LoadableScriptShellNeuralBase.TestApproximationTable(), IG.Num.MatrixBase.TestCholeskyDecomposition(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.TestClosestPoints(), IG.Script.LoadableScriptShellNeuralBase.TestClosestPoints(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.TestClosestPointsWithOutputs(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesLdlt_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesQR_IGLib(), IG.Lib.StopWatch1.TestExecutionTime(), IG.Num.VectorBase.TestGramSchmidtOrthogonalization(), IG.Num.MatrixBase.TestLdltDecomposition(), IG.Num.MatrixBase.TestLuDecomposition(), IG.Lib.ThreadPerformanceTest.TestPerformance(), IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance(), IG.Lib.ThreadPerformanceTest.TestPerformanceNum(), IG.Lib.CharacterBuffer.TestSpeed(), IG.Num.ScalarFunctionUntransformedBase.TestSpeed(), and IG.Num.RealFunction.TestSpeed().
|
inline |
Stops the timer and adds the time and CPU time difference measured in the last round to the total time. If the timer is not running then exception is thrown.
Referenced by IG.Lib.WaitFileEventLatenceBase.ExampleLatence.AlternateCreateRemoveExample(), IG.Crypto.CryptoManager.AppAsymTest(), IG.Crypto.CryptoManager.AppEncryptSymmetricAll(), IG.Num.SimKosecFileManagerBase.CalculateVectorResponse(), IG.Neural.NeuralAllpicationCommands.CmdTestJson(), IG.Neural.NeuralAllpicationCommands.cmdTestSerializationNeural(), IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvReadDefinitionAndData(), IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvWriteDefinitionAndData(), IG.Lib.StopWatch1.Example(), IG.Lib.RealFunctionLoader.Example(), IG.Lib.ScalarFunctionLoader.Example(), IG.Gr3d.TestVtkGraphicBase.ExampleCellsGridContours(), IG.Gr3d.TestVtkGraphicBase.ExampleCellsGridEfficient(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.ExampleClosestPointsDummy(), IG.Lib.UtilSystem.ExampleCopyDir(), IG.Gr3d.TestVtkGraphicBase.ExampleQuadCells(), IG.Gr3d.TestVtkGraphicBase.ExampleStructuredGrid(), IG.Lib.CommandLineApplicationInterpreter.ExitRepeatBlock(), IG.Script.LoadableScriptShellNeuralBase.ParSimRunJob(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.PrintNeighborDistanceStatistics(), IG.Lib.CommandLineApplicationInterpreter.RunRepeat(), IG.Script.LoadableScriptShellNeuralBase.TestAnalysis(), IG.Script.LoadableScriptShellNeuralBase.TestAnalysisTable(), IG.Script.LoadableScriptShellNeuralBase.TestApproximation(), IG.Script.LoadableScriptShellNeuralBase.TestApproximationTable(), IG.Num.MatrixBase.TestCholeskyDecomposition(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.TestClosestPoints(), IG.Script.LoadableScriptShellNeuralBase.TestClosestPoints(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.TestClosestPointsWithOutputs(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesLdlt_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesQR_IGLib(), IG.Num.VectorBase.TestGramSchmidtOrthogonalization(), IG.Num.MatrixBase.TestLdltDecomposition(), IG.Num.MatrixBase.TestLuDecomposition(), IG.Lib.ThreadPerformanceTest.TestPerformance(), IG.Lib.ThreadPerformanceTest.TestPerformanceNum(), IG.Lib.CharacterBuffer.TestSpeed(), and IG.Num.RealFunction.TestSpeed().
|
inline |
Resets the timer. Its state becomes identical to the state right after creation (as it has not been used before).
Referenced by IG.Lib.WaitFileEventLatenceBase.ExampleLatence.AlternateCreateRemoveExample(), IG.Gr3d.TestVtkGraphicBase.ExampleCellsGridContours(), IG.Gr3d.TestVtkGraphicBase.ExampleCellsGridEfficient(), IG.Gr3d.TestVtkGraphicBase.ExampleQuadCells(), IG.Gr3d.TestVtkGraphicBase.ExampleStructuredGrid(), IG.Lib.CharacterBuffer.TestSpeed(), and IG.Num.RealFunction.TestSpeed().
|
inline |
|
inline |
|
inline |
Referenced by IG.Num.RealFunction.TestSpeed().
|
inline |
|
inlinestatic |
Gets a timespan object that is equivalent to the specified time in seconds, and returns it.
There need not be whole number of seconds.
seconds | Time in seconds for which the equivalent TimeSpan object is returned. |
|
inlinestatic |
Example of using the stopwatch.
References IG.Lib.Util.SleepSeconds(), IG.Lib.StopWatch1.Start(), IG.Lib.StopWatch1.Stop(), IG.Lib.StopWatch1.Time, IG.Lib.StopWatch1.TimeSpan, IG.Lib.StopWatch1.TotalTime, and IG.Lib.StopWatch1.TotalTimeSpan.
delegate void IG.Lib.StopWatch1.VoidDelegate | ( | ) |
|
inlinestatic |
|
staticprotected |
|
staticprivate |
|
protected |
Lock object to be used for locking the current object.
|
protected |
|
protected |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
private |
|
private |
|
private |
|
protected |
|
protected |
|
private |
|
private |
|
private |
|
staticprotected |
|
static |
|
staticgetprotected |
Static lock object accessible only from the current class.
Global lock object Util.LockGlobal is used to synchronize creation of this lock.
|
get |
Lock object to be used for locking the current object.
|
get |
Returns a flag indicating whether the stopwatch is currently running.
|
get |
Returns counter's ID.
|
get |
Gets the data from time stamp contained in the timer.
|
get |
|
get |
Gets the total time in seconds, measured by the timer up to the current moment. If the timer is running then the current absolute time is calculated, and difference with the last starting time added to the total time accumulated in previous rounds.
Referenced by IG.Crypto.CryptoManager.AppEncryptSymmetricAll(), IG.Num.SimKosecFileManagerBase.CalculateVectorResponse(), IG.Neural.NeuralAllpicationCommands.CmdTestJson(), IG.Neural.NeuralAllpicationCommands.cmdTestSerializationNeural(), IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvWriteDefinitionAndData(), IG.Lib.StopWatch1.Example(), IG.Gr3d.TestVtkGraphicBase.ExampleCellsGridContours(), IG.Gr3d.TestVtkGraphicBase.ExampleCellsGridEfficient(), IG.Gr3d.TestVtkGraphicBase.ExampleQuadCells(), IG.Gr3d.TestVtkGraphicBase.ExampleStructuredGrid(), IG.Lib.CommandLineApplicationInterpreter.ExitRepeatBlock(), IG.Lib.CommandLineApplicationInterpreter.RunRepeat(), IG.Num.MatrixBase.TestCholeskyDecomposition(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.TestClosestPoints(), IG.Script.LoadableScriptShellNeuralBase.TestClosestPoints(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.TestClosestPointsWithOutputs(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesLdlt_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesQR_IGLib(), IG.Num.MatrixBase.TestLdltDecomposition(), IG.Num.MatrixBase.TestLuDecomposition(), IG.Lib.ThreadPerformanceTest.TestPerformance(), IG.Lib.ThreadPerformanceTest.TestPerformanceNum(), and IG.Num.ScalarFunctionUntransformedBase.TestSpeed().
|
get |
Gets the total CPU time in seconds, measured by the timer up to the current moment. If the timer is running then the current CPU time is calculated, and difference with the last starting CPU time added to the total CPU time accumulated in previous rounds.
Referenced by IG.Crypto.CryptoManager.AppEncryptSymmetricAll(), IG.Lib.CommandLineApplicationInterpreter.ExitRepeatBlock(), IG.Lib.CommandLineApplicationInterpreter.RunRepeat(), IG.Num.MatrixBase.TestCholeskyDecomposition(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesLdlt_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesQR_IGLib(), IG.Num.MatrixBase.TestLdltDecomposition(), IG.Num.MatrixBase.TestLuDecomposition(), IG.Lib.ThreadPerformanceTest.TestPerformance(), IG.Lib.ThreadPerformanceTest.TestPerformanceNum(), and IG.Num.ScalarFunctionUntransformedBase.TestSpeed().
|
get |
Returns the elapsed time measured by the timer in the last round. If the timer is running then the current time is calculated and its difference with the starting time returned.
Referenced by IG.Lib.WaitFileEventLatenceBase.ExampleLatence.AlternateCreateRemoveExample(), IG.Crypto.CryptoManager.AppAsymTest(), IG.Crypto.CryptoManager.AppEncryptSymmetricAll(), IG.Num.SimKosecFileManagerBase.CalculateVectorResponse(), IG.Neural.NeuralAllpicationCommands.CmdTestJson(), IG.Neural.NeuralAllpicationCommands.cmdTestSerializationNeural(), IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvReadDefinitionAndData(), IG.Lib.StopWatch1.Example(), IG.Lib.RealFunctionLoader.Example(), IG.Lib.ScalarFunctionLoader.Example(), IG.Gr3d.TestVtkGraphicBase.ExampleCellsGridContours(), IG.Gr3d.TestVtkGraphicBase.ExampleCellsGridEfficient(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.ExampleClosestPointsDummy(), IG.Lib.UtilSystem.ExampleCopyDir(), IG.Gr3d.TestVtkGraphicBase.ExampleQuadCells(), IG.Gr3d.TestVtkGraphicBase.ExampleStructuredGrid(), IG.Lib.CommandLineApplicationInterpreter.ExitRepeatBlock(), IG.Script.LoadableScriptShellNeuralBase.ParSimRunJob(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.PrintNeighborDistanceStatistics(), IG.Lib.CommandLineApplicationInterpreter.RunRepeat(), IG.Script.LoadableScriptShellNeuralBase.TestAnalysis(), IG.Script.LoadableScriptShellNeuralBase.TestAnalysisTable(), IG.Script.LoadableScriptShellNeuralBase.TestApproximation(), IG.Script.LoadableScriptShellNeuralBase.TestApproximationTable(), IG.Num.MatrixBase.TestCholeskyDecomposition(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.TestClosestPoints(), IG.Script.LoadableScriptShellNeuralBase.TestClosestPoints(), IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.TestClosestPointsWithOutputs(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesLdlt_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesQR_IGLib(), IG.Num.VectorBase.TestGramSchmidtOrthogonalization(), IG.Num.MatrixBase.TestLdltDecomposition(), IG.Num.MatrixBase.TestLuDecomposition(), IG.Lib.ThreadPerformanceTest.TestPerformance(), IG.Num.ParallelJobContainerGen< InputType, ResultType >.TestPerformance(), IG.Lib.ThreadPerformanceTest.TestPerformanceNum(), and IG.Lib.CharacterBuffer.TestSpeed().
|
get |
Returns the elapsed CPU time measured by the timer in the last round. If the timer is running then the current CPU time is calculated and its difference with the starting time returned.
Referenced by IG.Crypto.CryptoManager.AppEncryptSymmetricAll(), IG.Script.LoadableScriptShellNeuralBase.TestAnalysis(), IG.Script.LoadableScriptShellNeuralBase.TestAnalysisTable(), IG.Script.LoadableScriptShellNeuralBase.TestApproximation(), IG.Script.LoadableScriptShellNeuralBase.TestApproximationTable(), IG.Num.MatrixBase.TestCholeskyDecomposition(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesCholesky_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesLdlt_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_Base(), IG.Num.SpeedTestCpu.TestComputationalTimesLU_IGLib(), IG.Num.SpeedTestCpu.TestComputationalTimesQR_IGLib(), IG.Num.VectorBase.TestGramSchmidtOrthogonalization(), IG.Num.MatrixBase.TestLdltDecomposition(), IG.Num.MatrixBase.TestLuDecomposition(), and IG.Num.RealFunction.TestSpeed().
|
get |
Referenced by IG.Lib.StopWatch1.Example().
|
get |
|
get |
Referenced by IG.Lib.StopWatch1.Example().
|
get |