summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2011-04-26 16:14:55 +0000
committersobomax <sobomax@FreeBSD.org>2011-04-26 16:14:55 +0000
commite19591c5077914564e9818802d634404fc9e3808 (patch)
tree27eafd98a1267f14124f482bbe81a9141ce31262 /sys/amd64
parent42001445f1faf025f673623feee8363cb4b2868c (diff)
downloadFreeBSD-src-e19591c5077914564e9818802d634404fc9e3808.zip
FreeBSD-src-e19591c5077914564e9818802d634404fc9e3808.tar.gz
With the typical memory size of the system in tenth of gigabytes
counting memory being dumped in 16MB increments is somewhat silly. Especially if the dump fails and everything you've got for debugging is screen filled with numbers in 16 decrements... Replace that with percentage-based progress with max 10 updates all fitting into one line. Collapse other very "useful" piece of crash information (total ram) into the same line to save some more space. MFC after: 1 week
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/minidump_machdep.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/sys/amd64/amd64/minidump_machdep.c b/sys/amd64/amd64/minidump_machdep.c
index aeab32b..92b922d 100644
--- a/sys/amd64/amd64/minidump_machdep.c
+++ b/sys/amd64/amd64/minidump_machdep.c
@@ -62,7 +62,7 @@ static off_t dumplo;
/* Handle chunked writes. */
static size_t fragsz;
static void *dump_va;
-static size_t counter, progress;
+static size_t counter, progress, dumpsize;
CTASSERT(sizeof(*vm_page_dump) == 8);
@@ -94,6 +94,40 @@ blk_flush(struct dumperinfo *di)
return (error);
}
+static struct {
+ int min_per;
+ int max_per;
+ int visited;
+} progress_track[10] = {
+ { 0, 10, 0},
+ { 10, 20, 0},
+ { 20, 30, 0},
+ { 30, 40, 0},
+ { 40, 50, 0},
+ { 50, 60, 0},
+ { 60, 70, 0},
+ { 70, 80, 0},
+ { 80, 90, 0},
+ { 90, 100, 0}
+};
+
+static void
+report_progress(size_t progress, size_t dumpsize)
+{
+ int sofar, i;
+
+ sofar = 100 - ((progress * 100) / dumpsize);
+ for (i = 0; i < 10; i++) {
+ if (sofar < progress_track[i].min_per || sofar > progress_track[i].max_per)
+ continue;
+ if (progress_track[i].visited)
+ return;
+ progress_track[i].visited = 1;
+ printf("..%d%%", sofar);
+ return;
+ }
+}
+
static int
blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
{
@@ -130,7 +164,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
counter += len;
progress -= len;
if (counter >> 24) {
- printf(" %ld", PG2MB(progress >> PAGE_SHIFT));
+ report_progress(progress, dumpsize);
counter &= (1<<24) - 1;
}
if (ptr) {
@@ -170,7 +204,6 @@ static pd_entry_t fakepd[NPDEPG];
void
minidumpsys(struct dumperinfo *di)
{
- uint64_t dumpsize;
uint32_t pmapsize;
vm_offset_t va;
int error;
@@ -290,8 +323,8 @@ minidumpsys(struct dumperinfo *di)
mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_AMD64_VERSION, dumpsize, di->blocksize);
- printf("Physical memory: %ju MB\n", ptoa((uintmax_t)physmem) / 1048576);
- printf("Dumping %llu MB:", (long long)dumpsize >> 20);
+ printf("Dumping %llu out of %ju MB:", (long long)dumpsize >> 20,
+ ptoa((uintmax_t)physmem) / 1048576);
/* Dump leader */
error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh));
OpenPOWER on IntegriCloud