home *** CD-ROM | disk | FTP | other *** search
- /* char.c - char output benchmark for Blaise CTools package */
- #include "stdio.h"
- #include "screen.h"
- #include "utility.h"
-
- main()
- {
- int nit, nper, attr, mode, row, col, c, i,j,t ;
- float tf ;
- char s[200] ;
-
- printf("no.iter. no.chars/iter char attr and mode : \n");
- scanf("%d %d %x %x %d",&nit,&nper,& c, &attr,&mode) ;
-
- screset(mode) ; /* set mode */
- timer() ; /* start timer */
- for(i=0 ; i<nit ; i++)
- { sccurset(i % 16,0) ; /* set cursor position */
- for( j=0 ; j<nper ; j++ )
- { wca(c,attr) ; } /* write the char */
- }
- t = timer() ; /* collect elapsed time */
- tf = ( (float) t) / 18.2 ;
- sccurset(20,0) ; /* set cursor position */
- printf(" %10.2f secs per 1000 chars \n",
- tf*1000.0 /(nit*nper) );
-
- utinkey() ; /* wait for a keystroke */
- /* now time string write */
- for( j=0 ; j<nper ; j++ ) /* build a string */
- { s[j] = (j & 0x3f) + 0x20 ; }
- s[j] = '\0' ;
-
- timer() ; /* start timer */
- for(i=0 ; i<nit ; i++)
- { sccurset(i % 16,0) ; /* set cursor position */
- wsa(s,attr) ; /* write the string */
- wsa(s,attr) ; /* write the string again */
- }
- t = timer() ; /* collect elapsed time */
- tf = ( (float) t) / 18.2 ;
- sccurset(20,0) ; /* set cursor position */
- printf(" %10.2f secs per 1000 chars \n",
- tf*500.0 /(nit*nper) );
- }