Use a twiddle to show that we're busy dumping. The initial code

emitted the total number of pages it still had to dump prior to
dumping a block of up to 16 pages. For a 128MB region this would
result in 8M number of printf()s. Barf!

The problem in general is that memory typically has one really
big region and a number of "scattered" smaller regions. Some may
even be just a few pages. The twiddle works best for now, but
it doesn't really give a good progress indication for the large
regions. Those are the cases where you definitely want good PI
to avoid having the user turn into a twiddle :-)
This commit is contained in:
marcel 2002-04-03 05:11:59 +00:00
parent 6625b0cb22
commit 436b1d297c
2 changed files with 14 additions and 10 deletions

View File

@ -124,17 +124,19 @@ cb_dumpdata(EFI_MEMORY_DESCRIPTOR *mdp, int seqnr, void *arg)
vm_offset_t pa;
uint64_t pgs;
size_t sz;
int error;
printf(" region %d:", seqnr);
int error, twiddle;
error = 0; /* catch case in which mdp->NumberOfPages is 0 */
twiddle = 0;
pgs = mdp->NumberOfPages;
pa = IA64_PHYS_TO_RR7(mdp->PhysicalStart);
printf(" region %d: %ld pages ", seqnr, (long)pgs);
while (pgs) {
sz = (pgs > (DFLTPHYS >> EFI_PAGE_SHIFT))
? DFLTPHYS : pgs << EFI_PAGE_SHIFT;
printf(" %lld", pgs);
printf("%c\b", "|/-\\"[twiddle++ & 3]);
error = di->dumper(di->priv, (void*)pa, NULL, dumplo, sz);
if (error)
break;
@ -142,7 +144,7 @@ cb_dumpdata(EFI_MEMORY_DESCRIPTOR *mdp, int seqnr, void *arg)
pgs -= sz >> EFI_PAGE_SHIFT;
pa += sz;
}
printf("\n");
printf("... %s\n", (error) ? "fail" : "ok");
return (error);
}

View File

@ -124,17 +124,19 @@ cb_dumpdata(EFI_MEMORY_DESCRIPTOR *mdp, int seqnr, void *arg)
vm_offset_t pa;
uint64_t pgs;
size_t sz;
int error;
printf(" region %d:", seqnr);
int error, twiddle;
error = 0; /* catch case in which mdp->NumberOfPages is 0 */
twiddle = 0;
pgs = mdp->NumberOfPages;
pa = IA64_PHYS_TO_RR7(mdp->PhysicalStart);
printf(" region %d: %ld pages ", seqnr, (long)pgs);
while (pgs) {
sz = (pgs > (DFLTPHYS >> EFI_PAGE_SHIFT))
? DFLTPHYS : pgs << EFI_PAGE_SHIFT;
printf(" %lld", pgs);
printf("%c\b", "|/-\\"[twiddle++ & 3]);
error = di->dumper(di->priv, (void*)pa, NULL, dumplo, sz);
if (error)
break;
@ -142,7 +144,7 @@ cb_dumpdata(EFI_MEMORY_DESCRIPTOR *mdp, int seqnr, void *arg)
pgs -= sz >> EFI_PAGE_SHIFT;
pa += sz;
}
printf("\n");
printf("... %s\n", (error) ? "fail" : "ok");
return (error);
}