129534Ssam #ifndef lint
2*32662Skarels static char sccsid[] = "@(#)profile.c	1.3 (Berkeley/CCI) 11/23/87";
329534Ssam #endif
429534Ssam 
529534Ssam 
629534Ssam #include	"vdfmt.h"
729534Ssam 
829534Ssam #define	cycles	10
929534Ssam 
1029534Ssam /*
1129534Ssam **
1229534Ssam */
1329534Ssam 
profile()1429534Ssam profile()
1529534Ssam {
1629534Ssam 	unsigned int	total_time, i, step, remainder;
1729534Ssam 	dskadr		ead, zero;
1829534Ssam 	char		digit_buf[20];
1929534Ssam 
2029534Ssam 	print("Disk seek profile for ");
2129534Ssam 	printf("controller %d, drive %d, ", cur.controller, cur.drive);
22*32662Skarels 	printf("type %s.\n", lab->d_typename);
2329534Ssam 
2429534Ssam 	indent();
2529534Ssam 	if(is_formatted() == false) {
2629534Ssam 		print("Can not profile unformatted drives!\n");
2729534Ssam 		_longjmp(abort_environ, 1);
2829534Ssam 	}
2929534Ssam 	print(" Seek  |                  Seek time (ms)\n");
3029534Ssam 	print("Length |0    5    10   15   20   25   30   35   40   45   50\n");
3129534Ssam 	print("-------|-----+----+----+----+----+----+----+----+----+----+\n");
3229534Ssam 
3329534Ssam 	cur.state = prof;
3429534Ssam 	zero.cylinder = zero.track = zero.sector=0;
3529534Ssam 	ead.track = ead.sector=0;
36*32662Skarels 	step = lab->d_ncylinders / 55;
37*32662Skarels 	for(ead.cylinder=1; ead.cylinder<lab->d_ncylinders; ead.cylinder+=step){
3829534Ssam 		total_time = 0;
3929534Ssam 		for(i=0; i<cycles; i++) {
4031318Ssam 			access_dsk((char *)save, &zero, VDOP_SEEK, 1, 60);
4131318Ssam 			access_dsk((char *)save, &ead, VDOP_SEEK, 1, 60);
4229534Ssam 			if(kill_processes == true)
4329534Ssam 				_longjmp(quit_environ, 1);
4429534Ssam 			total_time += ((2*60*1000*1000) - vdtimeout);
4529534Ssam 		}
4629534Ssam 		print("");
4729534Ssam 		sprintf(digit_buf, "%d      ", ead.cylinder);
4829534Ssam 		for(i=0; i<7; i++)
4929534Ssam 			putchar(digit_buf[i]);
5029534Ssam 		putchar('|');
5129534Ssam 		total_time /= cycles;
5229534Ssam 		remainder = total_time % 10;
5329534Ssam 		total_time /= 10;
5429534Ssam 		while(total_time--)
5529534Ssam 			putchar(' ');
5629534Ssam 		if(remainder >= 5)
5729534Ssam 			printf("+\n");
5829534Ssam 		else
5929534Ssam 			printf("*\n");
6029534Ssam 		DELAY(400000);
6129534Ssam 	}
6229534Ssam 	print("-------|-----+----+----+----+----+----+----+----+----+----+\n");
6329534Ssam 	print("       |0    5    10   15   20   25   30   35   40   45   50\n");
6429534Ssam 	exdent(1);
6529534Ssam 	printf("Profile completed successfully.\n");
6629534Ssam }
6729534Ssam 
68