openwrt/package/compcache/patches/200-av_compress_ratio.patch

40 lines
1.2 KiB
Diff
Raw Normal View History

diff -uNr compcache-0.5.4-old/ramzswap.c compcache-0.5.4/ramzswap.c
--- compcache-0.5.4-old/ramzswap.c 2009-10-18 09:14:53.000000000 +0200
+++ compcache-0.5.4/ramzswap.c 2009-10-18 09:12:08.000000000 +0200
@@ -126,7 +126,9 @@
{
int len;
size_t succ_writes, mem_used;
- unsigned int good_compress_perc = 0, no_compress_perc = 0;
+ unsigned int good_compress_perc = 0,
+ av_compression_perc = 0,
+ no_compress_perc = 0;
mem_used = xv_get_total_size_bytes(rzs.mem_pool)
+ (stats.pages_expand << PAGE_SHIFT);
@@ -154,6 +156,8 @@
if (succ_writes && stats.pages_stored) {
good_compress_perc = stats.good_compress * 100
/ stats.pages_stored;
+ av_compression_perc = stats.compr_size * 100
+ / (stats.good_compress << PAGE_SHIFT);
no_compress_perc = stats.pages_expand * 100
/ stats.pages_stored;
}
@@ -168,6 +172,7 @@
"NotifyFree: %8llu\n"
"ZeroPages: %8u\n"
"GoodCompress: %8u %%\n"
+ "AvCompression: %8u %%\n"
"NoCompress: %8u %%\n"
"PagesStored: %8u\n"
"PagesUsed: %8zu\n"
@@ -182,6 +187,7 @@
stats.notify_free,
stats.pages_zero,
good_compress_perc,
+ av_compression_perc,
no_compress_perc,
stats.pages_stored,
mem_used >> PAGE_SHIFT,