From: raster Date: Thu, 28 Oct 2010 10:00:22 +0000 (+0000) Subject: put in some disabled cache dump dbg. X-Git-Tag: 2.0_alpha~240^2~1372 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f398f8556c0557b456a38d3c98654f288659940;p=framework%2Fuifw%2Fevas.git put in some disabled cache dump dbg. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@53949 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/cache/evas_cache_image.c b/src/lib/cache/evas_cache_image.c index c50ec55..81781eb 100644 --- a/src/lib/cache/evas_cache_image.c +++ b/src/lib/cache/evas_cache_image.c @@ -43,6 +43,46 @@ static void _evas_cache_image_entry_preload_remove(Image_Entry *ie, const void * eina_stringshare_del(Var); \ Var = NULL; \ } +//#define CACHEDUMP 1 + +#ifdef CACHEDUMP +static void +_dump_img(Image_Entry *im, const char *type) +{ + printf("%s: %4i: %4ikb, %4ix%4i alloc[%4ix%4i] [%s] [%s]\n", + type, + im->references, + (im->allocated.w * im->allocated.h * 4) / 1024, + im->w, im->h, im->allocated.w, im->allocated.h, + im->file, im->key); +} + +static Eina_Bool +_dump_cache_active(__UNUSED__ const Eina_Hash *hash, __UNUSED__ const void *key, void *data, void *fdata __UNUSED__) +{ + Image_Entry *im = data; + + _dump_img(im, "ACTIVE"); + return EINA_TRUE; +} + +static void +_dump_cache(Evas_Cache_Image *cache) +{ + Image_Entry *im; + + printf("--CACHE DUMP----------------------------------------------------\n"); + printf("%cache: %ikb / %ikb\n", + cache->usage / 1024, + cache->limit / 1024); + printf("................................................................\n"); + EINA_INLIST_FOREACH(cache->lru_nodata, im) + _dump_img(im, "NODATA"); + EINA_INLIST_FOREACH(cache->lru, im) + _dump_img(im, "DATA "); + eina_hash_foreach(cache->activ, _dump_cache_active, NULL); +} +#endif static void _evas_cache_image_entry_delete(Evas_Cache_Image *cache, Image_Entry *ie); @@ -1450,6 +1490,9 @@ evas_cache_image_flush(Evas_Cache_Image *cache) assert(cache); assert(cache->usage >= 0); +#ifdef CACHEDUMP + _dump_cache(cache); +#endif if (cache->limit == (unsigned int)-1) return -1; while ((cache->lru) && (cache->limit < (unsigned int)cache->usage))