aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2008-06-08 17:35:08 +0000
committerRafael J. Wysocki <rjw@sisk.pl>2008-06-08 17:35:08 +0000
commitbe150bb939079ebef8830c19f1d42d5266dc5d4a (patch)
tree504eeb693830f591e9391cd788fd5bc1c8b11727
parent095b4b4162c5ee369e55e23324028bddf0935b51 (diff)
downloadsuspend-utils-be150bb939079ebef8830c19f1d42d5266dc5d4a.tar.gz
Currently, the compression ratio is only printed during suspend, which is not
quite useful.  Make it also be printed during resume, along with the other performance numbers, so that it can be checked with the help of the "resume pause =" option. Additionally, print the "real" write speed if compression is used.
-rw-r--r--load.c26
-rw-r--r--suspend.c8
2 files changed, 29 insertions, 5 deletions
diff --git a/load.c b/load.c
index d2932ac..2dab2fa 100644
--- a/load.c
+++ b/load.c
@@ -660,8 +660,32 @@ int read_or_verify_image(int dev, int fd, struct image_header_info *header,
mb *= 2.0;
delta += header->writeout_time;
- printf("total image i/o %0.1lf MB in %0.1lf seconds "
+ printf("total image i/o: %0.1lf MB in %0.1lf seconds "
"(%0.1lf MB/s)\n", mb, delta, mb / delta);
+
+ if (do_decompress) {
+ double real_size = header->image_data_size;
+
+ printf("%s: Compression ratio %4.2lf\n", my_name,
+ real_size / (header->pages * page_size));
+ real_size /= (1024.0 * 1024.0);
+ delta -= header->writeout_time;
+
+ printf("wrote %0.1lf MB of compressed data in %0.1lf "
+ "seconds (%0.1lf MB/s)\n", real_size,
+ header->writeout_time,
+ real_size / header->writeout_time);
+
+ printf("read %0.1lf MB of compressed data in %0.1lf "
+ "seconds (%0.1lf MB/s)\n", real_size,
+ delta, real_size / delta);
+
+ real_size *= 2.0;
+ delta += header->writeout_time;
+ printf("total compressed data i/o: %0.1lf MB in %0.1lf "
+ "seconds (%0.1lf MB/s)\n", real_size, delta,
+ real_size / delta);
+ }
}
Exit_encrypt:
diff --git a/suspend.c b/suspend.c
index f8a085e..909a3ca 100644
--- a/suspend.c
+++ b/suspend.c
@@ -60,10 +60,8 @@ static int suspend_loglevel = SUSPEND_LOGLEVEL;
static char compute_checksum;
#ifdef CONFIG_COMPRESS
static char do_compress;
-static long long compr_size;
#else
#define do_compress 0
-#define compr_size 0
#endif
#ifdef CONFIG_ENCRYPT
static char do_encrypt;
@@ -751,7 +749,6 @@ static int save_buffer(struct swap_writer *handle)
handle->lzo_work_buffer);
block->size = cnt;
size = cnt + sizeof(size_t);
- compr_size += size;
}
#endif
/* If there's no compression, handle->buffer == handle->write_buffer */
@@ -923,6 +920,7 @@ static int write_image(int snapshot_fd, int resume_fd)
struct image_header_info *header;
loff_t start;
loff_t image_size;
+ double real_size;
unsigned long nr_pages = 0;
int error;
int image_header_read = 0;
@@ -974,6 +972,7 @@ static int write_image(int snapshot_fd, int resume_fd)
nr_pages--;
}
printf("%s: Image size: %lu kilobytes\n", my_name, image_size / 1024);
+ real_size = image_size;
handle.swap_needed = image_size;
if (!enough_swap(&handle)) {
@@ -1054,6 +1053,7 @@ Save_image:
fsync(resume_fd);
header->image_data_size = handle.written_data;
+ real_size = handle.written_data;
/*
* NOTICE: This needs to go after save_image(), because the
@@ -1091,7 +1091,7 @@ Save_image:
if (!error) {
if (do_compress) {
printf("%s: Compression ratio %4.2lf\n", my_name,
- (double)compr_size / image_size);
+ real_size / image_size);
}
printf("S");
error = mark_swap(resume_fd, start);