Copyright© Kambiz R. Khojasteh. All rights reserved.
Get future component updates from http://www.delphiarea.com.
If you are looking for an easy and accurate way to measure execution time of your code for free, TProfiler is what you need. TProfiler is a non-visual component that enables you to create named timers in your code.
Each timer of TProfiler contains the following information:
- The number of times that the timer was activated (Hit Count)
- The total execution time
- The average exceution time on each hit
- Execution time on the first hit
- Execution time on the last hit
- The hit with minimum execution time
- The hit with maximum execution time
PROPERTIES
- Resolution: Extended (Read-only)
Resolution of timer in seconds. Resolution of timer depends on hardware, but in worst case is one millisecond.- AutoOutputDebug: Boolean
Indicates whether the component automattically sends timers information to the debugger's output screen.- Timers: TProfilerTimers (Read-only)
Collection of timers. Use this property to add new timers or access timers by index.- TimerByName[const TimerName: String]: TProfilerTimer (Read-only, Default)
Provides access to timers by name. If the timer with the specified name does not exist, the component creates a new timer.
TimerByName is the default property of TProfiler component. It means for example, to access a timer named FirstTimer you can use Profiler['FirstTimer'] instead of Profiler.TimerByName['FirstTimer'].METHODS
- procedure OutputDebugTimers;
Sends information of each timer to the debugger's output screen (or log).
Note: In Delphi IDE, you can see the debug output screen by selecting [View\Debug Windows\Event Log] from menu or pressing Ctrl+Alt+V shortcut keys.EVENTS
- OnTimerStart: TProfilerNotifyEvent;
TProfilerNotifyEvent = procedure(Sender: TObject; Timer: TProfilerTimer) of object;
Occurs just before a timer starts.- OnTimerStop: TProfilerNotifyEvent;
TProfilerNotifyEvent = procedure(Sender: TObject; Timer: TProfilerTimer) of object;
Occurs just after a timer stopped.
PROPERTIES
- Profiler: TProfiler (Read-only)
Specifies the profiler that owns this timer.- Name: String
Determines name of timer.- DisplayFormat: String
Specifies how time should be displayed. The DisplayFormat follows rules of FormatFloat procedure of Delphi.- TimeUnit: TTimeUnit
Determines unit of time for time properties. TimeUnit property can have one of the following values:
tuNanosecond Express time in nanoseconds. (1 second = 1,000,000,000 nanoseconds) tuMicrosecond Express time in microseconds. (1 second = 1,000,000 microseconds) tuMillisecond Express time in milliseconds. (1 second = 1,000 milliseconds) tuSecond Express time in seconds. tuMinute Express time in minutes. tuHour Express time in hours. - LastTime: Extended (Read-only)
Determines elapsed time on the first run of timer. Unit of time is detemined by TimeUnit property.- FirstTime: Extended(Read-only)
Determines elapsed time on the last run of timer. Unit of time is detemined by TimeUnit property.- AvgTime: Extended (Read-only)
Determines average elapsed time on each run of timer. Unit of time is detemined by TimeUnit property.- MinHit: DWORD (Read-only)
Specifies the hit number with the minimum elapsed time. The minimum elapsed time specifies by the MinTime property.- MinTime: Extended (Read-only)
Determines the minimum elapsed time within all runs of the timer. Unit of time is detemined by TimeUnit property.- MaxHit: DWORD (Read-only)
Specifies the hit number with the maximum elapsed time. The maximum elapsed time specifies by the MaxTime property.- MaxTime: Extended (Read-only)
Determines the maximum elapsed time within all runs of the timer. Unit of time is detemined by TimeUnit property.- TotalHits: Extended (Read-only)
Determines the total number of times that timer was executed.- TotalTime: Extended (Read-only)
Specifies elapsed time on all runs of the timer. Unit of time is detemined by TimeUnit property.- AsText[TimeInfo: TTimeInfo]: String (Read-only)
Returns the requested time information as string. Format and unit of time specifies respectively by DisplayFormat and TimeUnit properties. The timer information is one of the following values:
tiAll All timing information tiTotal Time of all runs tiAvg Average time of each run tiFirst Time of first run tiLast Time of last run tiMin Minimum elapsed time within all runs tiMax Maximum elapsed time within all runs METHODS
- procedure Start;
Starts timer.- procedure Stop;
Stops timer.- procedure Reset;
Resets all timing information to zero.
TProfiler component is freeware. You may copy component's files AS LONG AS YOU COPY ALL OF THEM. If you want to change the source code in order to improve the component's features, performance, etc. please send me the new source code so that I can have a look at it. The changed source code should contain descriptions what you have changed, and of course your name. The only thing you MAY NOT CHANGE is the ORIGINAL COPYRIGHT INFORMATION.
TFindFile is provided "AS IS" without any warranty of any kind, either express or implied. The entire risk as to the quality and performance of the software is with you. The author is NOT liable for any DAMAGES resulting from the use and misuse of the component, especially he is NOT liable for DAMAGES that were caused BY ANY VERSION WHICH HAS NOT BEEN PROGRAMMED BY THE AUTHOR HIMSELF.
|
END OF DOCUMENT |