Displaying Additional Timing Information
- Updated2025-07-23
- 2 minute(s) read
Displaying Additional Timing Information
If you want to view the timing of additional operations the system performs relative to the operations the Execution Profiler shows, surround the additional operations with TestStand locks, even if the resources involved do not need multiple thread access protection. For example, to display when a lengthy calculation takes place and how long it takes, you can surround the calculation with a TestStand lock named "My Lengthy Calculation".
If you add a lock for profiling purposes around an operation that does not need thread synchronization, you can use a unique lock in each thread to ensure that multiple threads can run the operation in parallel. When each thread uses its own lock, a thread can never block waiting for another thread to release the lock. You can create a lock unique to a thread by appending a name unique to the thread to the name of the lock you create. A convenient source of a name unique to a TestStand thread is the Thread.UniqueThreadId property, which is available in TestStand expressions and from the TestStand API. For example, you can surround a lengthy calculation with a lock named "My Lengthy Calculation - " + RunState.Thread.UniqueThreadId.
An alternative method to display information in the profiler is to call the Engine.LogProfilerAction method.For example, before starting an operation you want the profiler to display, you might execute an expression similar to:
RunState.Engine.LogProfilerAction("Calibration", "", ThisContext, Str(RunState.Thread.Id), RunState.Thread.DisplayName, "Measure Fixture Wiring Delay", ProfilerState_InUse, "Delay Compensation", -1, True, Nothing)
After the operation completes, you might execute an expression similar to:
RunState.Engine.LogProfilerAction("Calibration", "", ThisContext, Str(RunState.Thread.Id), RunState.Thread.DisplayName, "Measure Fixture Wiring Delay", ProfilerState_Completed, "Delay Compensation", -1, True, Nothing)