From 6b2676d33f2e6c25dc98eda57325e7185a6ff763 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 28 Nov 2014 19:17:42 +0000 Subject: Improve llcache writeout stratagy --- desktop/netsurf.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'desktop/netsurf.c') diff --git a/desktop/netsurf.c b/desktop/netsurf.c index 21fedfddf..cca80232b 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -72,17 +72,23 @@ /** default time between content cache cleans. */ #define HL_CACHE_CLEAN_TIME (2 * IMAGE_CACHE_CLEAN_TIME) -/** default minimum object time before object is pushed to backing store. */ -#define LLCACHE_MIN_DISC_LIFETIME (60 * 30) - -/** default maximum bandwidth for backing store writeout. */ -#define LLCACHE_MAX_DISC_BANDWIDTH (128 * 1024) - /** ensure there is a minimal amount of memory for source objetcs and * decoded bitmaps. */ #define MINIMUM_MEMORY_CACHE_SIZE (2 * 1024 * 1024) +/** default minimum object time before object is pushed to backing store. (s) */ +#define LLCACHE_STORE_MIN_LIFETIME (60 * 30) + +/** default minimum bandwidth for backing store writeout. (byte/s) */ +#define LLCACHE_STORE_MIN_BANDWIDTH (128 * 1024) + +/** default maximum bandwidth for backing store writeout. (byte/s) */ +#define LLCACHE_STORE_MAX_BANDWIDTH (1024 * 1024) + +/** default time quantum with which to calculate bandwidth (ms) */ +#define LLCACHE_STORE_TIME_QUANTUM (100) + static void netsurf_lwc_iterator(lwc_string *str, void *pw) { LOG(("[%3u] %.*s", str->refcnt, (int) lwc_string_length(str), lwc_string_data(str))); @@ -126,8 +132,10 @@ nserror netsurf_init(const char *messages, const char *store_path) .bg_clean_time = HL_CACHE_CLEAN_TIME, .llcache = { .cb = netsurf_llcache_query_handler, - .minimum_lifetime = LLCACHE_MIN_DISC_LIFETIME, - .bandwidth = LLCACHE_MAX_DISC_BANDWIDTH, + .minimum_lifetime = LLCACHE_STORE_MIN_LIFETIME, + .minimum_bandwidth = LLCACHE_STORE_MIN_BANDWIDTH, + .maximum_bandwidth = LLCACHE_STORE_MAX_BANDWIDTH, + .time_quantum = LLCACHE_STORE_TIME_QUANTUM, } }; struct image_cache_parameters image_cache_parameters = { -- cgit v1.2.3