From: Tonnerre <tonnerre@thundrix.ch>
To: Pavel Machek <pavel@ucw.cz>
Cc: kernel list <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@zip.com.au>,
Patrick Mochel <mochel@digitalimplant.org>
Subject: Re: swsusp: progress in percent
Date: Sat, 11 Sep 2004 15:03:24 +0200 [thread overview]
Message-ID: <20040911130324.GB14771@thundrix.ch> (raw)
In-Reply-To: <20040910084704.GB12751@elf.ucw.cz>
[-- Attachment #1: Type: text/plain, Size: 2267 bytes --]
Salut,
On Fri, Sep 10, 2004 at 10:47:04AM +0200, Pavel Machek wrote:
> --- 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++)%4]); ?
> + }
> + 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");
Didn't we say we want the page count here?
> 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);
> }
>
>
Thanks for enlightenment.
Tonnerre
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2004-09-11 13:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-10 8:47 swsusp: progress in percent Pavel Machek
2004-09-11 13:03 ` Tonnerre [this message]
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=20040911130324.GB14771@thundrix.ch \
--to=tonnerre@thundrix.ch \
--cc=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@digitalimplant.org \
--cc=pavel@ucw.cz \
/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.