TAPE: Improve attach time tape scan performance
This commit is contained in:
parent
d12ae2a3f3
commit
0d894613f9
1 changed files with 35 additions and 36 deletions
17
sim_tape.c
17
sim_tape.c
|
@ -643,7 +643,9 @@ fprintf (st, " specified file. This record size will be used for
|
||||||
fprintf (st, " possibly the last record which will be what remains unread.\n");
|
fprintf (st, " possibly the last record which will be what remains unread.\n");
|
||||||
fprintf (st, " The default TAR record size is 10240.\n");
|
fprintf (st, " The default TAR record size is 10240.\n");
|
||||||
fprintf (st, " -V Display some summary information about the record structure\n");
|
fprintf (st, " -V Display some summary information about the record structure\n");
|
||||||
fprintf (st, " contained in the tape structure.\n");
|
fprintf (st, " contained in the tape image scan performed when it is attached.\n");
|
||||||
|
fprintf (st, " -S Perform reverse reads and forward skips during the attach time\n");
|
||||||
|
fprintf (st, " tape image scan.\n");
|
||||||
fprintf (st, " -D Causes the internal tape structure information to be displayed\n");
|
fprintf (st, " -D Causes the internal tape structure information to be displayed\n");
|
||||||
fprintf (st, " while the tape image is scanned.\n");
|
fprintf (st, " while the tape image is scanned.\n");
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
|
@ -759,6 +761,7 @@ t_tpclnt tpcbc;
|
||||||
t_awshdr awshdr;
|
t_awshdr awshdr;
|
||||||
size_t rdcnt;
|
size_t rdcnt;
|
||||||
t_mtrlnt buffer [256]; /* local tape buffer */
|
t_mtrlnt buffer [256]; /* local tape buffer */
|
||||||
|
t_addr saved_pos;
|
||||||
uint32 bufcntr, bufcap; /* buffer counter and capacity */
|
uint32 bufcntr, bufcap; /* buffer counter and capacity */
|
||||||
int32 runaway_counter, sizeof_gap; /* bytes remaining before runaway and bytes per gap */
|
int32 runaway_counter, sizeof_gap; /* bytes remaining before runaway and bytes per gap */
|
||||||
t_stat status = MTSE_OK;
|
t_stat status = MTSE_OK;
|
||||||
|
@ -876,12 +879,7 @@ else switch (f) { /* otherwise the read me
|
||||||
}
|
}
|
||||||
|
|
||||||
else { /* otherwise it's a record marker */
|
else { /* otherwise it's a record marker */
|
||||||
if (bufcntr < bufcap /* if the position is within the buffer */
|
saved_pos = uptr->pos; /* Save data position */
|
||||||
&& sim_fseek (uptr->fileref, uptr->pos, SEEK_SET)) { /* then seek to the data area; if it fails */
|
|
||||||
status = sim_tape_ioerr (uptr); /* then quit with I/O error status */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
sbc = MTR_L (*bc); /* extract the record length */
|
sbc = MTR_L (*bc); /* extract the record length */
|
||||||
uptr->pos = uptr->pos + sizeof (t_mtrlnt) /* position to the start */
|
uptr->pos = uptr->pos + sizeof (t_mtrlnt) /* position to the start */
|
||||||
+ (f == MTUF_F_STD ? (sbc + 1) & ~1 : sbc); /* of the record */
|
+ (f == MTUF_F_STD ? (sbc + 1) & ~1 : sbc); /* of the record */
|
||||||
|
@ -893,7 +891,6 @@ else switch (f) { /* otherwise the read me
|
||||||
status = MTSE_RUNAWAY; /* then report it */
|
status = MTSE_RUNAWAY; /* then report it */
|
||||||
|
|
||||||
if (status == MTSE_OK) { /* Validate the reverse record size */
|
if (status == MTSE_OK) { /* Validate the reverse record size */
|
||||||
t_addr saved_pos = (t_addr)sim_ftell(uptr->fileref);
|
|
||||||
t_mtrlnt rev_lnt;
|
t_mtrlnt rev_lnt;
|
||||||
|
|
||||||
if (sim_fseek (uptr->fileref, uptr->pos - sizeof (t_mtrlnt), SEEK_SET)){ /* then seek to the end of record size; if it fails */
|
if (sim_fseek (uptr->fileref, uptr->pos - sizeof (t_mtrlnt), SEEK_SET)){ /* then seek to the end of record size; if it fails */
|
||||||
|
@ -2983,6 +2980,7 @@ while (r == SCPE_OK) {
|
||||||
++unique_record_sizes;
|
++unique_record_sizes;
|
||||||
++rec_sizes[bc_f];
|
++rec_sizes[bc_f];
|
||||||
}
|
}
|
||||||
|
if (sim_switches & SWMASK ('S')) {
|
||||||
memset (buf_r, 0, max);
|
memset (buf_r, 0, max);
|
||||||
r_r = sim_tape_rdrecr (uptr, buf_r, &bc_r, max);
|
r_r = sim_tape_rdrecr (uptr, buf_r, &bc_r, max);
|
||||||
pos_r = uptr->pos;
|
pos_r = uptr->pos;
|
||||||
|
@ -3011,6 +3009,7 @@ while (r == SCPE_OK) {
|
||||||
sim_printf ("Unexpected Space Record Length: %d vs %d\n", bc_s, bc_f);
|
sim_printf ("Unexpected Space Record Length: %d vs %d\n", bc_s, bc_f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
r = SCPE_OK;
|
r = SCPE_OK;
|
||||||
break;
|
break;
|
||||||
case MTSE_INVRL: /* invalid rec lnt */
|
case MTSE_INVRL: /* invalid rec lnt */
|
||||||
|
@ -3041,7 +3040,7 @@ if ((r != MTSE_EOM) || (sim_switches & SWMASK ('V')) ||
|
||||||
sim_printf ("%u bytes of tape data (%u records, %u tapemarks)\n",
|
sim_printf ("%u bytes of tape data (%u records, %u tapemarks)\n",
|
||||||
data_total, record_total, tapemark_total);
|
data_total, record_total, tapemark_total);
|
||||||
if (record_total > 0) {
|
if (record_total > 0) {
|
||||||
sim_printf ("Comprising (in record size order):\n");
|
sim_printf ("Comprising %d different sized records (in record size order):\n", unique_record_sizes);
|
||||||
for (bc = 0; bc <= max; bc++) {
|
for (bc = 0; bc <= max; bc++) {
|
||||||
if (rec_sizes[bc])
|
if (rec_sizes[bc])
|
||||||
sim_printf ("%8u %u byte records\n", rec_sizes[bc], (uint32)bc);
|
sim_printf ("%8u %u byte records\n", rec_sizes[bc], (uint32)bc);
|
||||||
|
|
Loading…
Add table
Reference in a new issue