📄 highrestimer.pas
字号:
unit HighResTimer;
{******************************************************************************
* *
* THighResTimer Component *
* *
* Component for high resolution time measurement and wait routines. *
* The component can reach resolution and accuracy of a few micro seconds. *
* Because Win32 is not a real time operating system the resolution and the *
* accuracy of this component can't be garuanteed. Setting the execution thread*
* and the component thread to an approbiate priority the resolution and *
* accuracy will be with in the limits for more than 90% of the calls. *
* Remarks: *
* For high accuracy of the time stamp counter a calibration should last two *
* seconds or longer. *
* Ussage hints: *
* For pure time measurement the timer doesn't need to be enabled. At the *
* begining test wether the TSC can be used or not. *
* Befor using the Wait function enable the timer. The default calibration *
* is fast but not very accurate, so do a custom calibrate if needed. *
* After a change of the UseTSC property always a recalibration is needed for*
* high accuracy. Use TSC can be cahnged only if timer is disabled. *
* *
* If you find any bugs or improvements, please let me know. If you modify the *
* source code, please send me a copy. *
* *
* Legal issues: *
* *
* Copyright (C) 2002 by Roman Lauer <lauerr@gmx.de> *
* *
* This software is provided 'as-is', without any express or implied *
* warranty. In no event will the author be held liable for any damages *
* arising from the use of this software. *
* *
* Permission is granted to anyone to use this software for any purpose, *
* including commercial applications, and to alter it and redistribute it *
* freely, subject to the following restrictions: *
* *
* 1. The origin of this software must not be misrepresented, you must not *
* claim that you wrote the original software. If you use this software *
* in a product, an acknowledgment in the product documentation would be *
* appreciated but is not required. *
* *
* 2. Altered source versions must be plainly marked as such, and must not be *
* misrepresented as being the original software. *
* *
* 3. This notice may not be removed or altered from any source distribution. *
* *
* 4. These components may not be included in any component package that is *
* distributed for profit. *
* *
* Credits go to: *
* Robert T. Palmqvist: I copy his header for these comments *
* Udo Juerss: I used his TimeStampCounter and put it into this component. *
* Autor of Component tacpuid: Used some of his assembler routines. *
* (with modifications) *
* *
* Bibliography: *
* *
* http://www.pergolesi.demon.co.uk/prog/threads/ToC.html *
* Tutorial about multi threading with delphi *
* MSDN *
* Learned about multi media timers. *
* IA-32 Intel
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -