Time a function: Difference between revisions
m
→{{header|Delphi}}
Line 968:
{{libheader|SysUtils,StdCtrls}}
[[File:DelphiTimerObject.png|frame|none]]
Here is a simple timer object that I use to time different parts of the code,
The object is based on the TPanel, which means the
The time is controlled by four different
'''Reset'''. Reset zeros the
'''Start'''. Starts the timer running.
'''Stop'''. Stops the timer.
'''Displays'''. Displays the current cumulative time since the first start.
Start and Stop can be moved around the code to control which parts are timed. You can even turn the timer on and off multiple times to messure the combined execution times of multiple different sections of code. You can also move the Start and Stop commands closer and closer together to zoom in on the part of the code that takes the most time to execute.
|