lkml.org 
[lkml]   [2006]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[Suspend2][ 07/13] [Suspend2] Compression debug stats.
Date
Fill a buffer with debugging information about whether compression was
enabled and (if so) what ratio was achieved.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

kernel/power/compression.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/kernel/power/compression.c b/kernel/power/compression.c
index 5193423..6578e8c 100644
--- a/kernel/power/compression.c
+++ b/kernel/power/compression.c
@@ -374,4 +374,29 @@ static int suspend_compress_read_chunk(s
return ret;
}

+/*
+ * suspend_compress_print_debug_stats
+ * @buffer: Pointer to a buffer into which the debug info will be printed.
+ * @size: Size of the buffer.
+ *
+ * Print information to be recorded for debugging purposes into a buffer.
+ * Returns: Number of characters written to the buffer.
+ */
+
+static int suspend_compress_print_debug_stats(char *buffer, int size)
+{
+ int pages_in = bytes_in >> PAGE_SHIFT,
+ pages_out = bytes_out >> PAGE_SHIFT;
+ int len;
+
+ /* Output the compression ratio achieved. */
+ len = snprintf_used(buffer, size, "- Compressor %s enabled.\n",
+ suspend_compressor_name);
+ if (pages_in)
+ len+= snprintf_used(buffer+len, size - len,
+ " Compressed %ld bytes into %ld (%d percent compression).\n",
+ bytes_in, bytes_out, (pages_in - pages_out) * 100 / pages_in);
+ return len;
+}
+

--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-27 07:18    [W:0.280 / U:0.000 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site