From: Pavel Machek <pavel@ucw.cz>
To: kernel list <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@zip.com.au>,
Patrick Mochel <mochel@digitalimplant.org>
Subject: swsusp: progress in percent
Date: Fri, 10 Sep 2004 10:47:04 +0200 [thread overview]
Message-ID: <20040910084704.GB12751@elf.ucw.cz> (raw)
Hi!
swsusp currently has very poor progress indication. Thanks to Erik
Rigtorp <erik@rigtorp.com>, we have percentages there, so people know
how long wait to expect. Please apply,
[I'd prefer this to be start of "next batch" of changes to linus. It
would be nice if linus could pull previous version from power tree...]
From: Erik Rigtorp <erik@rigtorp.com>
Signed-off-by: Pavel Machek <pavel@suse.cz>
Pavel
--- clean-mm/kernel/power/disk.c 2004-09-07 21:12:33.000000000 +0200
+++ linux-mm/kernel/power/disk.c 2004-09-08 22:47:41.000000000 +0200
@@ -91,10 +91,20 @@
static void free_some_memory(void)
{
- printk("Freeing memory: ");
- while (shrink_all_memory(10000))
- printk(".");
- printk("|\n");
+ unsigned int i = 0;
+ unsigned int tmp;
+ unsigned long pages = 0;
+ char *p = "-\\|/";
+
+ printk("Freeing memory... ");
+ while ((tmp = shrink_all_memory(10000))) {
+ pages += tmp;
+ printk("\b%c", p[i]);
+ i++;
+ if (i > 3)
+ i = 0;
+ }
+ printk("\bdone (%li pages freed)\n", pages);
}
--- clean-mm/kernel/power/swsusp.c 2004-09-07 21:12:33.000000000 +0200
+++ linux-mm/kernel/power/swsusp.c 2004-09-09 08:56:20.000000000 +0200
@@ -296,15 +292,19 @@
{
int error = 0;
int i;
-
- printk( "Writing data to swap (%d pages): ", nr_copy_pages );
+ unsigned int mod = nr_copy_pages / 100;
+
+ if (!mod)
+ mod = 1;
+
+ printk( "Writing data to swap (%d pages)... ", nr_copy_pages );
for (i = 0; i < nr_copy_pages && !error; i++) {
- if (!(i%100))
- printk( "." );
+ if (!(i%mod))
+ printk( "\b\b\b\b%3d%%", i / mod );
error = write_page((pagedir_nosave+i)->address,
&((pagedir_nosave+i)->swap_address));
}
- printk(" %d Pages done.\n",i);
+ printk("\b\b\b\bdone\n");
return error;
}
@@ -1153,14 +1120,18 @@
struct pbe * p;
int error;
int i;
-
+ int mod = nr_copy_pages / 100;
+
+ if (!mod)
+ mod = 1;
+
if ((error = swsusp_pagedir_relocate()))
return error;
- printk( "Reading image data (%d pages): ", nr_copy_pages );
+ printk( "Reading image data (%d pages): ", nr_copy_pages );
for(i = 0, p = pagedir_nosave; i < nr_copy_pages && !error; i++, p++) {
- if (!(i%100))
- printk( "." );
+ if (!(i%mod))
+ printk( "\b\b\b\b%3d%%", i / mod );
error = bio_read_page(swp_offset(p->swap_address),
(void *)p->address);
}
next reply other threads:[~2004-09-10 9:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-10 8:47 Pavel Machek [this message]
2004-09-11 13:03 ` Tonnerre
2004-09-11 17:05 ` Stefan Seyfried
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=20040910084704.GB12751@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@digitalimplant.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®