Dec 192017
TCHRT (Turbo C High Resolution Timer) is a software "toolbox" of routines to manipulate one hundred different timers each with one microsecond resolution.
File TCHRTV2.ZIP from The Programmer’s Corner in
Category C Source Code
TCHRT (Turbo C High Resolution Timer) is a software “toolbox” of routines to manipulate one hundred different timers each with one microsecond resolution.
File Name File Size Zip Size Zip Type
DEMOV2.C 3056 850 deflated
TCHRT.H 1059 309 deflated
TCHRTL.LIB 4608 2375 deflated
TCHRTS.LIB 4608 2316 deflated
TCHRTV2.DOC 18035 4892 deflated

Download File TCHRTV2.ZIP Here

Contents of the TCHRTV2.DOC file


Turbo C High Resolution Timer Toolbox

Ryle Design

P.O. Box 22, Mt. Pleasant, Michigan 48804

CompuServe 73047,1765

What is TCHRT?

TCHRT (Turbo C High Resolution Timer) is a software "toolbox" of routines to
manipulate one hundred different timers each with one microsecond resolution.
TCHRT 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 TCHRT function call.

Some uses for TCHRT are:

Source Code Timer/Profiler
By adding calls to TCHRT 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, TCHRT 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
TCHRT procedure calls.

Hardware Performance Evaluator
The high resolution and self calibration features of TCHRT 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 TCHRT, 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 TCHRT makes
compilation and interpretation of the test results quick and simple.

Process Control Applications
With TCHRT, 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 - TCHRT timer calls can be inserted in the
interrupt handler and precise, accurate timing of the critical procedure is

Timing and Scoring Equipment
TCHRT 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, TCHRT 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.


Distribution List

The distribution you have received should contain the following:

TCHRTV2.DOC This document
TCHRT.H C header file
TCHRTS.LIB Turbo C small model link library
TCHRTL.LIB Turbo C large model link library
DEMOV2.C Simple demonstration of TCHRT functions

Version 2.00 Enhancements

Version 2.00 of TCHRT 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 TCHRT libraries, 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 TCHRT functions is available in the reference
chapter of this document.

Additional Functions With Registration

This copy of TCHRT 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 TCHRT 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


3. Assembly language enhancements for users inserting TCHRT timers
in interrupt handlers.

4. Example code:

SEEKTEST.C - tests disk seek time
WATCH.C - dual stopwatch driven by keyboard interrupt 9h
HITIME.C - TSR high resolution timer

5. Complete, carefully commented source code to the entire TCHRT 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 Pascal V5.00 (TPHRT) 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

V2.00 Quick Reference

Users already familiar with Ryle Design PC Timer Toolboxes can reference the
following function list to begin using TCHRT immediately.

void t_ask_timer(int timer, long unsigned *count, long unsigned *elapsed)
void t_entry(int timer)
void t_exit(int timer)
void t_fname(char *file_name);
void t_name(int timer, char *timer_name)
void t_report(int where_to)
void t_reset(int timer)
void t_resume(int timer)
void t_rname(char *report_title)
void t_start(void)
void t_stop(void)
void t_suspend(int timer)


TCHRT Function Reference


Prototype void t_ask_timer(int timer, long unsigned *count,
long unsigned *elapsed)

Purpose To get current activation counts and accumulated elapsed time
for a specific timer.

Usage t_start(2,&hits,&elapsed);

Side Effects None. Queries TCHRT data structure, makes no DOS or BIOS

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



Prototype void t_entry(int timer)

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

Timers should be used in ascending order starting at 0.
Highest timer available is 99.

See also t_exit



Prototype void t_exit(int timer)

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



Prototype void t_fname(char *filename)

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 TCHRT data structure, makes no DOS or BIOS

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



Prototype void t_name(int timer, char *timer_name)

Purpose Attaches a descriptive string to a specified timer.

Usage t_name(2,"2D FFT");

Side Effects None. Modifies TCHRT data structure, makes no DOS or BIOS

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



Prototype void t_report(int whereto)

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

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 0.

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



Prototype void t_reset(int timer)

Purpose Allows the user to reset one or all timers

Usage t_reset(2);

Side Effects None. Modifies TCHRT data structure, makes no DOS or BIOS

Explanation This function zeros both activation count and elapsed time
for a specified timer (0-99). By passing -1 as the timer
number, all timers will be reset.

See also No other related functions.



Prototype void t_resume(int timer)

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

See also t_suspend



Prototype void t_rname(char *report_title)

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 TCHRT data structure, makes no DOS or BIOS

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



Prototype void t_start(void)

Purpose Initializes TCHRT 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 TCHRT timing
primitives, and must be called before any other TCHRT
functions are invoked.

See also t_stop



Prototype void t_stop(void)

Purpose Disables all TCHRT 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



Prototype void t_suspend(int timer)

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.


TCHRT Registration Form

Name __________________________________________________________________

Address _______________________________________________________________

City/State/Zip ________________________________________________________

Daytime Telephone _____________________________________________________

CompuServ ID (for tech support) _______________________________________

Where did you get your copy of TCHRT? ________________________________

What is your primary use of TCHRT? ____________________________________

Comments regarding this product _______________________________________




Check Products desired:

____ TCHRT Registered Version (Turbo C V2.0) ................. 7.50

____ TPHRT Registered Version (Turbo Pascal V5.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

 December 19, 2017  Add comments

Leave a Reply