From owner-svn-src-all@FreeBSD.ORG Tue Apr 26 16:14:55 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 858E41065670; Tue, 26 Apr 2011 16:14:55 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5979C8FC12; Tue, 26 Apr 2011 16:14:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3QGEtCZ029388; Tue, 26 Apr 2011 16:14:55 GMT (envelope-from sobomax@svn.freebsd.org) Received: (from sobomax@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3QGEtXx029386; Tue, 26 Apr 2011 16:14:55 GMT (envelope-from sobomax@svn.freebsd.org) Message-Id: <201104261614.p3QGEtXx029386@svn.freebsd.org> From: Maxim Sobolev Date: Tue, 26 Apr 2011 16:14:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221069 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2011 16:14:55 -0000 Author: sobomax Date: Tue Apr 26 16:14:55 2011 New Revision: 221069 URL: http://svn.freebsd.org/changeset/base/221069 Log: 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 Modified: head/sys/amd64/amd64/minidump_machdep.c Modified: head/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- head/sys/amd64/amd64/minidump_machdep.c Tue Apr 26 15:11:13 2011 (r221068) +++ head/sys/amd64/amd64/minidump_machdep.c Tue Apr 26 16:14:55 2011 (r221069) @@ -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 *p 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));