Category : C Source Code
Archive   : MSCHRT3.ZIP
Filename : DEMOV3.C

 
Output of file : DEMOV3.C contained in archive : MSCHRT3.ZIP
/*---------------------------------------------------------------------------
| Program DEMOV3.C |
| |
| This program demonstrates some of the capabilities of MSCHRT |
| |
| (c) 1989 Ryle Design, P.O. Box 22, Mt. Pleasant, Michigan 48804 |
| |
| V3.00 Microsoft C Shareware Evaluation Version |
---------------------------------------------------------------------------*/

#include
#include
#include
#include

#include "pchrt.h"

void sin_funct(void)
/*---------------------------------------------------------------------------
| A simple function to time. MSCHRT will tell us how many times this |
| function was called and how much time we spent here. |
| |
| Globals referenced: none |
| |
| Arguments: void |
| |
| Returns: void |
---------------------------------------------------------------------------*/
{
double alpha;

t_entry(4); /* start timer 4 */

alpha = sin(2.2734593); /* do something */

t_exit(4); /* stop timer 4 */

} /* sin_funct */



void main(void)
{
char tstring[25];
long unsigned hits, elapsed;
int indx;

t_request(5); /* ask for 5 timers */
if (t_start() != TRUE) /* init MSCHRT first thing */
{
printf("Insufficient heap for MSCHRT operation.\n");
exit(0);
}

t_entry(0); /* we use timer 0 to time whole run */

printf("MSCHRT V3.00 Demonstration\n\n");

printf("Press any key >> ");

t_entry(2); /* time getch() with timer 2 */
getch();
t_exit(2);

t_ask_timer(2,&hits,&elapsed); /* get timer 2 results */

printf("\nResponse time was %s\n",t_cvt_time(elapsed,tstring) );

printf("\nCalling sin function with embedded timer 100 times ... ");
for (indx=0; indx<100; indx++) sin_funct();
printf("complete\n\n");

printf("Press any key to generate timer reports >> ");
getche();
printf("\n");

t_exit(0); /* stop timer timing total run time */

t_set_report(NONZERO); /* specify report type */
t_rname("NONZERO report type"); /* report title */
t_name(0,"Total run time"); /* give each timer a name */
t_name(2,"getch() response");
t_name(4,"sin() function");
t_report(0); /* do report - (0) goes to CRT */

t_set_report(HIGHWATER); /* request different report type */
t_rname("HIGHWATER report type"); /* new name */
t_report(0); /* do it */

t_stop(); /* shut down MSCHRT and free heap */

printf("V3.00 Demo complete\n"); /* all done ... */

} /* main */





  3 Responses to “Category : C Source Code
Archive   : MSCHRT3.ZIP
Filename : DEMOV3.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/