Commit 8c002494 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] swsusp: add read-speed instrumentation

Add some instrumentation to the swsusp readin code to show what bandwidth
we're achieving.

Cc: Pavel Machek <pavel@ucw.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ab954160
...@@ -522,12 +522,15 @@ static int load_image(struct swap_map_handle *handle, ...@@ -522,12 +522,15 @@ static int load_image(struct swap_map_handle *handle,
unsigned int m; unsigned int m;
int ret; int ret;
int error = 0; int error = 0;
struct timeval start;
struct timeval stop;
printk("Loading image data pages (%u pages) ... ", nr_pages); printk("Loading image data pages (%u pages) ... ", nr_pages);
m = nr_pages / 100; m = nr_pages / 100;
if (!m) if (!m)
m = 1; m = 1;
nr_pages = 0; nr_pages = 0;
do_gettimeofday(&start);
do { do {
ret = snapshot_write_next(snapshot, PAGE_SIZE); ret = snapshot_write_next(snapshot, PAGE_SIZE);
if (ret > 0) { if (ret > 0) {
...@@ -539,11 +542,13 @@ static int load_image(struct swap_map_handle *handle, ...@@ -539,11 +542,13 @@ static int load_image(struct swap_map_handle *handle,
nr_pages++; nr_pages++;
} }
} while (ret > 0); } while (ret > 0);
do_gettimeofday(&stop);
if (!error) { if (!error) {
printk("\b\b\b\bdone\n"); printk("\b\b\b\bdone\n");
if (!snapshot_image_loaded(snapshot)) if (!snapshot_image_loaded(snapshot))
error = -ENODATA; error = -ENODATA;
} }
show_speed(&start, &stop, nr_pages, "Read");
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment