[gegl] gegl: switch tile cache size handling to 64 bit
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl: switch tile cache size handling to 64 bit
- Date: Thu, 28 Jun 2012 23:13:57 +0000 (UTC)
commit ae2110b993db8b17749555734d39e3c5ff7c0762
Author: Michael Natterer <mitch gimp org>
Date: Fri Jun 29 01:12:33 2012 +0200
gegl: switch tile cache size handling to 64 bit
and add a new GeglConfig property "tile-cache-size" of type guint64,
"cache-size" still exists but is deprecated and will go away in
gegl-0.3.
gegl/buffer/gegl-tile-handler-cache.c | 6 +++---
gegl/gegl-config.c | 29 ++++++++++++++++++++++-------
gegl/gegl-config.h | 2 +-
gegl/gegl-init.c | 4 ++--
4 files changed, 28 insertions(+), 13 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-handler-cache.c b/gegl/buffer/gegl-tile-handler-cache.c
index 63be009..060477e 100644
--- a/gegl/buffer/gegl-tile-handler-cache.c
+++ b/gegl/buffer/gegl-tile-handler-cache.c
@@ -88,7 +88,7 @@ static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
static GQueue *cache_queue = NULL;
static GHashTable *cache_ht = NULL;
static gint cache_wash_percentage = 20;
-static gint cache_total = 0; /* approximate amount of bytes stored */
+static guint64 cache_total = 0; /* approximate amount of bytes stored */
#ifdef GEGL_DEBUG_CACHE_HITS
static gint cache_hits = 0;
static gint cache_misses = 0;
@@ -524,10 +524,10 @@ gegl_tile_handler_cache_insert (GeglTileHandlerCache *cache,
g_hash_table_insert (cache_ht, item, item);
- while (cache_total > gegl_config()->cache_size)
+ while (cache_total > gegl_config()->tile_cache_size)
{
#ifdef GEGL_DEBUG_CACHE_HITS
- GEGL_NOTE(GEGL_DEBUG_CACHE, "cache_total:%i > cache_size:%i", cache_total, gegl_config()->cache_size);
+ GEGL_NOTE(GEGL_DEBUG_CACHE, "cache_total:"G_GUINT64_FORMAT" > cache_size:"G_GUINT64_FORMAT, cache_total, gegl_config()->tile_cache_size);
GEGL_NOTE(GEGL_DEBUG_CACHE, "%f%% hit:%i miss:%i %i]", cache_hits*100.0/(cache_hits+cache_misses), cache_hits, cache_misses, g_queue_get_length (cache_queue));
#endif
gegl_tile_handler_cache_trim (cache);
diff --git a/gegl/gegl-config.c b/gegl/gegl-config.c
index 8b61715..5cae39d 100644
--- a/gegl/gegl-config.c
+++ b/gegl/gegl-config.c
@@ -36,7 +36,8 @@ enum
{
PROP_0,
PROP_QUALITY,
- PROP_CACHE_SIZE,
+ PROP_CACHE_SIZE, /* deprecated */
+ PROP_TILE_CACHE_SIZE,
PROP_CHUNK_SIZE,
PROP_SWAP,
PROP_BABL_TOLERANCE,
@@ -57,7 +58,11 @@ gegl_config_get_property (GObject *gobject,
switch (property_id)
{
case PROP_CACHE_SIZE:
- g_value_set_int (value, config->cache_size);
+ g_value_set_int (value, config->tile_cache_size);
+ break;
+
+ case PROP_TILE_CACHE_SIZE:
+ g_value_set_uint64 (value, config->tile_cache_size);
break;
case PROP_CHUNK_SIZE:
@@ -109,7 +114,10 @@ gegl_config_set_property (GObject *gobject,
switch (property_id)
{
case PROP_CACHE_SIZE:
- config->cache_size = g_value_get_int (value);
+ config->tile_cache_size = g_value_get_int (value);
+ break;
+ case PROP_TILE_CACHE_SIZE:
+ config->tile_cache_size = g_value_get_uint64 (value);
break;
case PROP_CHUNK_SIZE:
config->chunk_size = g_value_get_int (value);
@@ -212,14 +220,21 @@ gegl_config_class_init (GeglConfigClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+ /* deprecated */
g_object_class_install_property (gobject_class, PROP_CACHE_SIZE,
g_param_spec_int ("cache-size",
"Cache size",
- "size of cache in bytes",
+ "deprecated, use tile-cache-size instead",
0, G_MAXINT, 512 * 1024 * 1024,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
+ G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, PROP_TILE_CACHE_SIZE,
+ g_param_spec_uint64 ("tile-cache-size",
+ "Tile Cache size",
+ "size of tile cache in bytes",
+ 0, G_MAXUINT64, 512 * 1024 * 1024,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
g_object_class_install_property (gobject_class, PROP_CHUNK_SIZE,
g_param_spec_int ("chunk-size",
diff --git a/gegl/gegl-config.h b/gegl/gegl-config.h
index bc60cdc..352c44b 100644
--- a/gegl/gegl-config.h
+++ b/gegl/gegl-config.h
@@ -38,7 +38,7 @@ struct _GeglConfig
GObject parent_instance;
gchar *swap;
- gint cache_size;
+ guint64 tile_cache_size;
gint chunk_size; /* The size of elements being processed at once */
gdouble quality;
gdouble babl_tolerance;
diff --git a/gegl/gegl-init.c b/gegl/gegl-init.c
index 6ef1d6f..3b06719 100644
--- a/gegl/gegl-init.c
+++ b/gegl/gegl-init.c
@@ -280,7 +280,7 @@ GeglConfig *gegl_config (void)
if (g_getenv ("GEGL_QUALITY"))
config->quality = atof(g_getenv("GEGL_QUALITY"));
if (g_getenv ("GEGL_CACHE_SIZE"))
- config->cache_size = atoi(g_getenv("GEGL_CACHE_SIZE"))* 1024*1024;
+ config->tile_cache_size = atoll(g_getenv("GEGL_CACHE_SIZE"))* 1024*1024;
if (g_getenv ("GEGL_CHUNK_SIZE"))
config->chunk_size = atoi(g_getenv("GEGL_CHUNK_SIZE"));
if (g_getenv ("GEGL_TILE_SIZE"))
@@ -485,7 +485,7 @@ gegl_post_parse_hook (GOptionContext *context,
if (cmd_gegl_quality)
config->quality = atof (cmd_gegl_quality);
if (cmd_gegl_cache_size)
- config->cache_size = atoi (cmd_gegl_cache_size)*1024*1024;
+ config->tile_cache_size = atoll (cmd_gegl_cache_size)*1024*1024;
if (cmd_gegl_chunk_size)
config->chunk_size = atoi (cmd_gegl_chunk_size);
if (cmd_gegl_tile_size)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]