[comp.sys.hp] An I/O performance tip...

jeffh@weycord.WEYCO.COM (03/17/88)

When I updated to 6.01 on my 350 I installed a third disc (trying 
to keep up with the grouth of hp-ux) on an external hpib interface. 
We had two discs on the internal high speed disc interface, 
an HP3565 (instrument) on the internal hpib interface and a 
scratch disc on an external hpib interface. I/O just didn't seem
right! I thought some of my large transfers were hanging. 

A couple of days ago a large read seemed to hang. I was looking at 
my code trying to figure out what happened. About a minute or so 
later the transfer completed! 

I desided to run a couple of tests doing large reads and writes
from/to the HP3565.

In test #1 the scratch disc was mounted on the external hpib interface.
Here are the results:

     transfer size:   400,000 bytes
     
         read time:   53.444 Seconds
     transfer rate:   7,484 bytes/Sec  ( remember the hp85 ?? )
     
        write time:   47.408 Seconds 
     transfer rate:   8,437 bytes/Sec  

In test #2 I unmounted the disc on the external hpib interface.
Here are the results:

     transfer size:   400,000 bytes
     
	 read time: 0.915 seconds
     transfer rate: 437,166 bytes/Sec 

        write time: 1.034
     transfer rate: 386,940 bytes/Sec


Humm, unmounting the disc seemed to help a little. That's a 58.4X 
performance improvement for a read and a 45.9X performance increase
on a write! The disc mounted on the external hpib interface was idle!
It was mounted- NOT active. It was on a seperate interface ?

The benchmark was done with the following configuration:
          
           O/S rev:   HP-UX 6.01
           machine:   350 - 8MB ram
     machine state:   idle
                 /    mounted from high-speed disc interface (7914)
             /users   mounted from high-speed disc interface   (7958) 
             /disc    mounted from external hpib interface (7958)
      
      DIL I/O card:   internal hpib 
       device file:   mknod /dev/hpib7 c 21 0x071f00
        instrument:   HP3565 digital signal processor 

This may not be a bug- if it isn't, it's a design defect...

Jeff Harrell
hpubvwa!weycord!jeffh


The little test program follows:


/******************************************************************
 **   usage: io_test transfer_size
 **                       ^     
 **                       :  
 **                       . in bytes 
 **
 **   compile with: cc io_test.c -ldvio -o io_test
 **
 **   to run above tests:
 **            1) mount a disc so that two interfaces are used
 **               for discs.
 **            2) Run test code.
 **            3) umount a disc so only one interface is used
 **               for discs.
 **            4) Run test code.
 **
  *****************************************************************/
#include <time.h>
#include <sys/rtprio.h>
#include <sys/lock.h>


int data[100000];

main(argc,argv)
int argc;
char *argv[];
{
	int iodes;
	int  MTA, MLA,id,i;
	float sys_time;
	char listencmd[4];
	char talkcmd[4];
	char response[64];
	struct timeval tme1,tme2;
	struct timezone zone;
	int size;
	int bytes,idle;
	char cmnd_string[40];

	size=atoi(argv[1]);
	plock(PROCLOCK);
	rtprio(0,0);
	iodes=open("/dev/hpib7",2);
 	io_speed_ctl(iodes,900);   /* seems to be a useless call */
        /*
	 **   Get MTA & MLA and setup talk & listen.
	  */ 
	MTA = hpib_bus_status ( iodes, 7) + 64;
	MLA = hpib_bus_status ( iodes, 7) + 32;
	listencmd[0] = 63;
	listencmd[1] = 64 + 11;
	listencmd[2] = MLA;
	talkcmd[0] = 63;
	talkcmd[1] = MTA;
	talkcmd[2] = 32 + 11;

        /*
	 **   setup the instrument.
	  */
	hpib_send_cmnd(iodes,talkcmd,3);
	write(iodes,"ABRT;DISA;\n",11);
	write(iodes,"NEW 200000;NEW?\n",16);
	hpib_send_cmnd(iodes,listencmd,3);
	read(iodes,response,256);
	sscanf(response,"%d",&id);
        /*
	 **   first test the read.
	  */
	sprintf(cmnd_string,"RBLD %d,%d\n",id,(size/2)-1);
	hpib_send_cmnd(iodes,talkcmd,3);
	write(iodes,cmnd_string,strlen(cmnd_string));
	hpib_send_cmnd(iodes,listencmd,3);
        /*
	 **   Cluge about .022 seconds for Paragon to do it's thing.
	 **   ( I didn't want to write assembly code in the HP3565
	 **     just for this test )	
	  */
	for(idle=0;idle<21000;idle++);  
        	
	gettimeofday(&tme1,&zone);
	bytes=read(iodes,data,size);
	gettimeofday(&tme2,&zone);

	sys_time= (float) (tme2.tv_sec-tme1.tv_sec);
	sys_time+=((float)(tme2.tv_usec-tme1.tv_usec))/1000000.0;
	printf("read time: %2.6f\ntransfer rate: %f\n",
		sys_time,bytes/sys_time);
	printf("transfer size: %d\n\n",bytes);
        /*
	 **   now test the write.
	  */
	sprintf(cmnd_string,"WBLD %d,%d,#I",id,(size/2));
	hpib_send_cmnd(iodes,talkcmd,3);
	write(iodes,cmnd_string,strlen(cmnd_string));
        /*
	 **   Cluge about .022 seconds for Paragon to do it's thing.
	 **   ( I didn't want to write assembly code in the HP3565
	 **     just for this test )	
	  */
	for(idle=0;idle<21000;idle++); 
	
	gettimeofday(&tme1,&zone);
	bytes=write(iodes,data,size);
	gettimeofday(&tme2,&zone);

	sys_time= (float) (tme2.tv_sec-tme1.tv_sec);
	sys_time+=((float)(tme2.tv_usec-tme1.tv_usec))/1000000.0;
	printf("write time: %2.6f\ntransfer rate: %f\n",
	       sys_time,bytes/sys_time);
	printf("transfer size: %d\n",bytes);
	close(iodes);
}