Skip to content

Commit

Permalink
[PATCH] swsusp: add read-speed instrumentation
Browse files Browse the repository at this point in the history
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: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Sep 26, 2006
1 parent ab95416 commit 8c00249
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/power/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,15 @@ static int load_image(struct swap_map_handle *handle,
unsigned int m;
int ret;
int error = 0;
struct timeval start;
struct timeval stop;

printk("Loading image data pages (%u pages) ... ", nr_pages);
m = nr_pages / 100;
if (!m)
m = 1;
nr_pages = 0;
do_gettimeofday(&start);
do {
ret = snapshot_write_next(snapshot, PAGE_SIZE);
if (ret > 0) {
Expand All @@ -539,11 +542,13 @@ static int load_image(struct swap_map_handle *handle,
nr_pages++;
}
} while (ret > 0);
do_gettimeofday(&stop);
if (!error) {
printk("\b\b\b\bdone\n");
if (!snapshot_image_loaded(snapshot))
error = -ENODATA;
}
show_speed(&start, &stop, nr_pages, "Read");
return error;
}

Expand Down

0 comments on commit 8c00249

Please sign in to comment.