home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <conio.h>
- #include <dos.h>
- typedef unsigned long dword;
-
- #ifdef M_I86 /* Identifier for MSC, Watcom, or ZTC */
-
- #ifndef __ZTC__
- #include <graph.h>
-
- #ifndef __WATCOMC__
- #define MK_FP(seg,off) ((void far *)(((dword)(seg)<<16)|(off)))
- #endif /* not Watcom */
-
- #define gotoxy(col,row) _settextposition(row,col)
- #define cputs(s) cputs(s "\r\n")
- #define cprintf(s) cprintf(s "\r\n")
-
- #else /* if ZTC */
-
- #include <disp.h>
- #include <smdefs.h>
- #define gotoxy(col,row) d_pos(row,col,0)
- #define cputs(s) disp_puts(s "\n")
- #define cprintf(s) disp_printf(s "\n")
-
- #endif /* if ZTC */
- #endif /* if TC */
-
- dword far *bios_time = MK_FP(0x0040,0x006C);
- dword time1,time2,time3,time4;
-
- main()
- {
- int i;
-
- #ifdef __ZTC__
- disp_open();
- #endif
- time1 = *bios_time;
- for(i = 1; i < 1000; i++)
- {
- gotoxy(10,5);
- puts("this is a test.");
- puts("this is the second line.");
- }
- time1 = *bios_time - time1;
- time2 = *bios_time;
- for(i = 1; i < 1000; i++)
- {
- gotoxy(10,5);
- printf("this is a test.\n");
- printf("this is the second line.\n");
- }
- time2 = *bios_time - time2;
- time3 = *bios_time;
- for(i = 1; i < 1000; i++)
- {
- #ifdef __ZTC__
- disp_move(10,5);
- #else
- gotoxy(10,5);
- #endif
- cputs("this is a test.");
- cputs("this is the second line.");
- }
- time3 = *bios_time - time3;
- time4 = *bios_time;
- for(i = 1; i < 1000; i++)
- {
- #ifdef __ZTC__
- disp_move(10,5);
- #else
- gotoxy(10,5);
- #endif
- cprintf("this is a test.");
- cprintf("this is the second line.");
- }
- time4 = *bios_time - time4;
-
- #ifdef __ZTC__
- disp_close();
- #endif
- printf("\nputs %10lu clock ticks",time1);
- printf("\nprintf %10lu clock ticks",time2);
- #ifndef __ZTC__
- printf("\ncputs %10lu clock ticks",time3);
- printf("\ncprintf %10lu clock ticks",time4);
- #else
- printf("\nd_puts %10lu clock ticks",time3);
- printf("\nd_printf %10lu clock ticks",time4);
- #endif
- }
-