home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TPHRT V2.00
-
- Turbo Pascal High Resolution Timer Toolbox
-
-
-
-
- Ryle Design
-
- P.O. Box 22, Mt. Pleasant, Michigan 48804
-
- CompuServe 73047,1765
-
-
-
-
-
-
-
- What is TPHRT?
-
- TPHRT (Turbo Pascal High Resolution Timer) is a software "toolbox" of routines
- to manipulate one hundred different timers each with one microsecond resolution.
- TPHRT makes it easy to very accurately time nearly any synchronous or
- asynchronous event your PC can encounter. Since the timer routines calibrate
- themselves to the host PC speed at run-time a single executable file will yield
- accurate timings across all 80xxx PC compatible environments. A complete report
- of all timer activity can be generated with a single TPHRT function call.
-
- Some uses for TPHRT are:
-
- Source Code Timer/Profiler
- --------------------------
- By adding calls to TPHRT in source code under development, the execution of
- that code can generate a detailed summary of execution time by program
- subroutine and immediately show the developer the program's "hot spots"
- that might benefit from further code or algorithm optimization. Unlike
- "binning" profilers that display the number of "hits" in a range of program
- counter addresses, TPHRT provides a direct one to one correspondence
- between source code and elapsed time with user defined granularity. A
- single line of source code can easily be timed with the insertion of two
- TPHRT procedure calls.
-
- Hardware Performance Evaluator
- ------------------------------
- The high resolution and self calibration features of TPHRT make it ideal
- for insertion in code to evaluate hardware performance. Disk drives,
- numeric processors and video controllers can all have their throughput
- measured very accurately with TPHRT, and with one hundred timers at the
- user's disposal, many device functions can be independently measured in a
- single run. The formatted timer report generated by TPHRT makes
- compilation and interpretation of the test results quick and simple.
-
- Process Control Applications
- ----------------------------
- With TPHRT, process control and data acquisition applications that require
- precise timing are easy to implement. No longer will the application
- developer have to make an educated guess as to how long a critical hardware
- interrupt is taking to service - TPHRT timer calls can be inserted in the
- interrupt handler and precise, accurate timing of the critical procedure is
- assured.
-
- Timing and Scoring Equipment
- ----------------------------
- TPHRT is the perfect "timer engine" to build a timing and scoring system
- for nearly any competitive event that requires high resolution timing.
- With it's one microsecond (0.000001) resolution, TPHRT surpasses
- conventional sports timing equipment resolution and thus allows the
- application developer to package both high resolution timing and complete
- event scoring in a single package.
-
-
-
-
-
- -1-
-
-
-
-
-
-
- Distribution List
-
- The distribution you have received should contain the following:
-
- TPHRTV2.DOC This document
- TPHRT.TPU Turbo Pascal V5.00 unit
- DEMOV2.PAS Simple demonstration of TPHRT functions
-
-
- Version 2.00 Enhancements
-
- Version 2.00 of TPHRT brings six new functions to the timer toolbox. Briefly
- they are as follows:
-
- t_reset Allows resetting of one or all active timers
- t_ask_timer Queries a specified timer and returns activation and elapsed
- time counts
- t_fname Allows the user to specify a file name for the timer report
- t_rname Allows the user to specify a title for the timer report
- t_suspend Suspends an active timer temporarily
- t_resume Causes a previously suspended timer to resume activity
-
- In addition, the version 1.00 function t_calib has been integrated into the
- t_start function and no longer needs to be explicitly called after t_start. In
- the interest of backward compatibility the t_calib function has been retained
- in the TPHRT unit, but users should remove the t_calib calls as they update
- their code to use the new functions in version 2.00.
-
- Complete information on all TPHRT functions is available in the reference
- chapter of this document.
-
-
- Additional Functions With Registration
-
- This copy of TPHRT is a shareware evaluation copy which you are encouraged to
- experiment with without obligation. If you find this timer toolbox to be useful
- you are encouraged to register your evaluation copy with Ryle Design, who will
- in turn provide you with the following:
-
- 1. Documentation of the low level TPHRT timer functions
-
- 2. Functions to profile selected BIOS interrupts
-
- t_bios_start enables BIOS interrupt profiling
- t_bios_stop disables BIOS interrupt profiling
- t_bios_suspend suspends BIOS interrupt profiling
- t_bios_resume resumes BIOS interrupt profiling
- t_bios_reset resets BIOS timers
- t_bios_ask returns time & count for BIOS interrupt
- t_bios_report generates BIOS timer summary
- t_bios_fname specifies file name for BIOS timer summary
- t_bios_rname specifies title for BIOS timer summary
-
-
-
- -2-
-
-
-
-
-
- 3. Enhancements for users inserting TPHRT timers in interrupt handlers
-
- 4. Example code:
-
- SEEKTEST.PAS - tests disk seek time
- WATCH.PAS - dual stopwatch driven by keyboard interrupt 9h
- HITIME.PAS - TSR high resolution timer
-
- 5. Complete, carefully commented source code to the entire TPHRT library
- including the t_bios extensions.
-
- 6. Technical support via CompuServ Easyplex mail.
-
-
- Registration is $7.50 which includes return shipping by first class mail in a
- crush proof disk envelope. Ryle Design also has versions of the timer toolbox
- available for Turbo C V2.00 (TCHRT) and Microsoft C V5.1 (MSCHRT). These
- are also available for $7.50 each from Ryle Design. Note that the code for
- Microsoft C and Turbo C is different as Microsoft C does not support inline asm
- statements as Borland does.
-
- A registration form is provided for your convenience as the last page of this
- document.
-
-
- V2.00 Quick Reference
-
- unit TPHRT;
-
- interface
-
- uses
- printer;
-
- type
- tname = string[20];
-
- { procedure prototypes }
-
- procedure t_start;
- procedure t_stop;
- procedure t_calib;
- procedure t_entry(tnum : integer);
- procedure t_exit(tnum : integer);
- procedure t_name(tnum : integer; name : tname);
- procedure t_report(whereto : integer);
-
- { V2.00 enhancements }
-
- procedure t_fname(fname : string);
- procedure t_rname(rname : string);
- procedure t_reset(tnum : integer);
- procedure t_ask_timer(tnum : integer; var hits : longint;
- var elapsed : longint);
- procedure t_suspend(tnum : integer);
- procedure t_resume(tnum : integer);
-
-
- implementation
- -3-
-
-
-
-
-
- TPHRT Function Reference
-
-
- t_ask_timer
-
-
- Prototype t_ask_timer(tnum : integer; var hits : longint;
- var elapsed : longint);
-
- Purpose To get current activation counts and accumulated elapsed time
- for a specific timer.
-
- Usage t_start(2,hits,elapsed);
-
- Side Effects None. Queries TPHRT data structure, makes no DOS or BIOS
- calls.
-
- Explanation This function and t_report are the means by which the user
- gets timer results. This function returns the number of
- timer activations and the amount of elapsed time (in micro-
- seconds) those activations consumed for a specific timer.
- This function is useful when the user wishes information on
- a specific timer or wishes to format his/her own timer report.
-
- See also t_report
-
-
- ________________________________________________________________________________
-
-
-
- t_entry
-
-
- Prototype t_entry(timer : integer)
-
- Purpose Starts a specific timer.
-
- Usage t_entry(2);
-
- Side Effects Interrupts are ON when t_entry() returns. Makes no DOS or
- BIOS calls.
-
- Explanation This function causes the specified timer to begin counting
- and to increment its activation count. The counter stops
- counting and adds to its total elapsed time with a call to
- t_exit.
-
- Timers should be used in ascending order starting at 1.
- Highest timer available is 100.
-
- See also t_exit
-
-
-
-
-
- -4-
-
-
-
-
- t_exit
-
-
- Prototype t_exit(timer : integer)
-
- Purpose Stops a specific timer.
-
- Usage t_exit(2);
-
- Side Effects Interrupts are ON when t_exit() returns. Makes no DOS or
- BIOS calls.
-
- Explanation This function causes the specified timer to stop counting
- and to add the elapsed time for this activation to the total
- elapsed time for this timer. Each t_entry call must have
- a corresponding t_exit call.
-
- See also t_entry
-
-
- ________________________________________________________________________________
-
-
-
- t_fname
-
-
- Prototype t_fname(filename : string)
-
- Purpose Changes the default report summary file name from PROFILE.TXT
- to a user specified name.
-
- Usage t_fname('NEWNAME.TXT');
-
- Side Effects None. Modifies TPHRT data structure, makes no DOS or BIOS
- calls.
-
- Explanation t_report can send a timer report to a disk file, which uses
- PROFILE.TXT as a default name. This function allows the
- user to specify some other file name using the full DOS
- drive:\path\name specification. Maximum string length is
- 66 characters.
-
- See also t_report
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -5-
-
-
-
-
- t_name
-
-
- Prototype t_name(timer : integer; name : tname)
-
- Purpose Attaches a descriptive string to a specified timer.
-
- Usage t_name(2,'2D FFT');
-
- Side Effects None. Modifies TPHRT data structure, makes no DOS or BIOS
- calls.
-
- Explanation t_name allows the user to associate a descriptive string
- with each timer. This string will appear next to the timer
- number on the timer report generated by t_report. Maximum
- string length is 20 characters.
-
- See also t_report
-
-
- ________________________________________________________________________________
-
-
-
- t_report
-
-
- Prototype t_report(whereto : integer)
-
- Purpose Generates a summary of all timer activity
-
- Usage t_report(0);
-
- Side Effects Calls DOS to do output. Not suitable for use in an interrupt
- handler.
-
- Explanation This function displays the following information on all
- active timers:
- Timer description (from t_name)
- Number of activations
- Total activation time
- Average activation time
-
- A count is kept of the highest timer activated, and all
- timers up to that number are displayed, so timers should
- be used in ascending order starting at 1.
-
- The timer report has a title, which defaults to
- "Profile Summary". This can be changed with t_rname.
-
- The integer flag whereto specifies the report destination:
- 0 = CRT
- 1 = file PROFILE.TXT or change with t_fname
- 2 = printer (PRN)
-
- See also t_name, t_rname, t_fname
-
-
-
- -6-
-
-
-
-
- t_reset
-
-
- Prototype t_reset(timer : integer)
-
- Purpose Allows the user to reset one or all timers
-
- Usage t_reset(2);
-
- Side Effects None. Modifies TPHRT data structure, makes no DOS or BIOS
- calls.
-
- Explanation This function zeros both activation count and elapsed time
- for a specified timer (1-100). By passing -1 as the timer
- number, all timers will be reset.
-
- See also No other related functions.
-
-
-
- ________________________________________________________________________________
-
-
-
- t_resume
-
-
- Prototype t_resume(timer : integer)
-
- Purpose Restarts a previously suspended timer
-
- Usage t_resume(2);
-
- Side effects Interrupts are ON when t_resume returns. Makes no DOS or
- BIOS calls.
-
- Explanation This functions restarts a timer temporarily stopped with
- t_suspend.
-
- See also t_suspend
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -7-
-
-
-
-
- t_rname
-
-
- Prototype t_rname(rname : string)
-
- Purpose Changes default timer report title from "Profile Summary"
- to a user specified string.
-
- Usage t_rname('Timings with 20 Mhz 80387');
-
- Side effects None. Modifies TPHRT data structure, makes no DOS or BIOS
- calls.
-
- Explanation t_report generates a timer summary with the default title
- "Profile Summary". This function allows the user to specify
- a different, more descriptive string. Maximum string length
- is 80 characters. The string is centered on the line.
-
- See also t_report
-
-
- ________________________________________________________________________________
-
-
-
- t_start
-
-
- Prototype t_start
-
- Purpose Initializes TPHRT timing primitives.
-
- Usage t_start;
-
- Side effects Changes 8253 timer to mode 2. Makes no DOS or BIOS calls.
-
- Explanation This function initializes and calibrates the TPHRT timing
- primitives, and must be called before any other TPHRT
- functions are invoked.
-
- See also t_stop
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -8-
-
-
-
-
- t_stop
-
-
- Prototype t_stop
-
- Purpose Disables all TPHRT timing primitives.
-
- Usage t_stop;
-
- Side effects Changes 8253 timer back to mode 3. Makes no DOS or BIOS calls.
-
- Explanation This function should be called when all active timers have
- been stopped prior to program termination.
-
- See also t_start
-
-
- ________________________________________________________________________________
-
-
-
- t_suspend
-
-
- Prototype t_suspend(timer : integer)
-
- Purpose Temporarily stops an active timer.
-
- Usage t_suspend(2);
-
- Side effects Interrupts are ON when t_suspend returns. Makes no DOS or
- BIOS calls.
-
- Explanation This function allows a timer to be stopped and restarted
- without an additional activation count being added. Useful
- if you use activation counts to track the number of function
- calls but for some reason want to stop the timer and restart
- it again later in the same function.
-
- See also t_resume.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -9-
-
-
-
-
-
-
-
-
- TPHRT Registration Form
-
-
-
- Name __________________________________________________________________
-
- Address _______________________________________________________________
-
- City/State/Zip ________________________________________________________
-
- Daytime Telephone _____________________________________________________
-
- CompuServ ID (for tech support) _______________________________________
-
- Where did you get your copy of TPHRT? ________________________________
-
- What is your primary use of TPHRT? ____________________________________
-
- Comments regarding this product _______________________________________
-
- _______________________________________________________________________
-
- _______________________________________________________________________
-
- _______________________________________________________________________
-
-
- Check Products desired:
-
-
- ____ TPHRT Registered Version (Turbo Pascal V5.0) ............ 7.50
-
- ____ TCHRT Registered Version (Turbo C V2.0) ................. 7.50
-
- ____ MSCHRT Registered Version (Microsoft C V5.1/MSDOS) ...... 7.50
-
- ____ All three of the above (save 2.50) ...................... 20.00
-
-
- Subtotal ................................................ _____
-
-
- Michigan residents add 4% sales tax ..................... _____
-
-
- Total enclosed (__check __money order) .................. _____
-
-
- Remit to: Ryle Design
- P.O. Box 22
- Mt. Pleasant, Michigan 48804
-
-
-
-
-