From: bwalle@suse.de (Bernhard Walle)
To: oomichi@mxs.nes.nec.co.jp
Cc: jlan@sgi.com, kexec@lists.infradead.org
Subject: [PATCH] Use progress bar also for bitmap creation
Date: Thu, 26 Jun 2008 16:37:21 +0200 [thread overview]
Message-ID: <20080626143721.GA12486@suse.de> (raw)
On large nodes, bitmap creation takes a serious amount of time. But the
progress indicator only starts after the bitmaps has been created, showing
only the progress of the copy process.
This patch adds a "message" parameter to the print_progress() function.
That message is displayed first and gets overwritten by next message.
So, the user sees
Excluding zero pages : [ 0 %]
Excluding zero pages : [... %]
Excluding zero pages : [100 %]
Copying data : [ 0 %]
Copying data : [... %]
Copying data : [100 %]
in sequence. IMO that's the fastest option to implement such a progress.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
---
makedumpfile.c | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -32,6 +32,17 @@ int message_level;
/*
* Forward declarations
*/
+void print_progress(const char *msg,
+ unsigned long current,
+ unsigned long end);
+
+/*
+ * Message texts
+ */
+#define PROGRESS_COPY "Copying data"
+#define PROGRESS_UNN_PAGES "Excluding unnecessary pages"
+#define PROGRESS_ZERO_PAGES "Excluding zero pages"
+#define PROGRESS_MAXLEN "35"
/*
* The numbers of the excluded pages
@@ -4062,6 +4073,9 @@ exclude_zero_pages()
}
for (pfn = paddr = 0; pfn < info->max_mapnr;
pfn++, paddr += info->page_size) {
+
+ print_progress(PROGRESS_ZERO_PAGES, pfn, info->max_mapnr);
+
if (!is_in_segs(paddr))
continue;
@@ -4100,6 +4114,8 @@ exclude_unnecessary_pages()
goto out;
}
for (mm = 0; mm < info->num_mem_map; mm++) {
+ print_progress(PROGRESS_UNN_PAGES, mm, info->num_mem_map);
+
mmd = &info->mem_map_data[mm];
pfn = mmd->pfn_start;
paddr = pfn*info->page_size;
@@ -4670,7 +4686,7 @@ write_kdump_header()
}
void
-print_progress(unsigned long current, unsigned long end)
+print_progress(const char *msg, unsigned long current, unsigned long end)
{
int progress;
time_t tm;
@@ -4686,7 +4702,7 @@ print_progress(unsigned long current, un
progress = 100;
PROGRESS_MSG("\r");
- PROGRESS_MSG("[%3d %%]", progress);
+ PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%3d %%] ", msg, progress);
}
int
@@ -4912,7 +4928,7 @@ write_elf_pages()
while (bufsz_remain > 0) {
if ((num_dumped % per) == 0)
- print_progress(num_dumped, num_dumpable);
+ print_progress(PROGRESS_COPY, num_dumped, num_dumpable);
if (bufsz_remain >= page_size)
bufsz_write = page_size;
@@ -5009,7 +5025,7 @@ write_elf_pages()
while (bufsz_remain > 0) {
if ((num_dumped % per) == 0)
- print_progress(num_dumped, num_dumpable);
+ print_progress(PROGRESS_COPY, num_dumped, num_dumpable);
if (bufsz_remain >= page_size)
bufsz_write = page_size;
@@ -5038,7 +5054,7 @@ write_elf_pages()
if (!write_cache_bufsz(&cd_seg))
goto out;
- print_progress(num_dumpable, num_dumpable);
+ print_progress(PROGRESS_COPY, num_dumpable, num_dumpable);
PROGRESS_MSG("\n");
ret = TRUE;
@@ -5247,7 +5263,7 @@ write_kdump_pages()
for (pfn = 0; pfn < info->max_mapnr; pfn++) {
if ((num_dumped % per) == 0)
- print_progress(num_dumped, num_dumpable);
+ print_progress(PROGRESS_COPY, num_dumped, num_dumpable);
if ((pfn % PFN_BUFBITMAP) == 0) {
if (info->len_bitmap - bm2.offset < BUFSIZE_BITMAP)
@@ -5325,7 +5341,7 @@ write_kdump_pages()
/*
* Print the progress of the end.
*/
- print_progress(num_dumpable, num_dumpable);
+ print_progress(PROGRESS_COPY, num_dumpable, num_dumpable);
PROGRESS_MSG("\n");
ret = TRUE;
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next reply other threads:[~2008-06-26 14:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-26 14:37 Bernhard Walle [this message]
2008-06-27 9:40 ` [PATCH] Use progress bar also for bitmap creation Ken'ichi Ohmichi
2008-07-07 2:50 ` Ken'ichi Ohmichi
2008-07-07 14:53 ` Bernhard Walle
2008-07-08 1:45 ` Ken'ichi Ohmichi
2008-07-08 11:28 ` Bernhard Walle
2008-07-08 15:43 ` Bernhard Walle
2008-07-08 18:30 ` Jay Lan
2008-07-08 18:47 ` Bernhard Walle
2008-07-09 0:25 ` Ken'ichi Ohmichi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080626143721.GA12486@suse.de \
--to=bwalle@suse.de \
--cc=jlan@sgi.com \
--cc=kexec@lists.infradead.org \
--cc=oomichi@mxs.nes.nec.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.