[gtk/glyphcache-fiddling: 9/11] gl: Improve debug spew for caches



commit 60d63bbadac4adadeaf0e00f3836a22793721f17
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Oct 12 12:32:49 2019 -0400

    gl: Improve debug spew for caches
    
    Dump similar information for both caches,
    and correct the unused percentage for
    the atlases.

 gsk/gl/gskglglyphcache.c   |  2 ++
 gsk/gl/gskgliconcache.c    | 11 ++++++++++-
 gsk/gl/gskgltextureatlas.c |  4 +++-
 3 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gl/gskglglyphcache.c b/gsk/gl/gskglglyphcache.c
index f68837444c..ee34e611c0 100644
--- a/gsk/gl/gskglglyphcache.c
+++ b/gsk/gl/gskglglyphcache.c
@@ -357,5 +357,7 @@ gsk_gl_glyph_cache_begin_frame (GskGLGlyphCache *self,
 
           value->accessed = FALSE;
        }
+
+      GSK_NOTE(GLYPH_CACHE, g_message ("%d glyphs cached", g_hash_table_size (self->hash_table)));
     }
 }
diff --git a/gsk/gl/gskgliconcache.c b/gsk/gl/gskgliconcache.c
index ea733939b9..31ede9bcdf 100644
--- a/gsk/gl/gskgliconcache.c
+++ b/gsk/gl/gskgliconcache.c
@@ -76,12 +76,19 @@ gsk_gl_icon_cache_begin_frame (GskGLIconCache *self,
   /* Drop icons on removed atlases */
   if (removed_atlases->len > 0)
     {
+      guint dropped = 0;
+
       g_hash_table_iter_init (&iter, self->icons);
       while (g_hash_table_iter_next (&iter, (gpointer *)&texture, (gpointer *)&icon_data))
         {
           if (g_ptr_array_find (removed_atlases, icon_data->atlas, NULL))
-            g_hash_table_iter_remove (&iter);
+            {
+              g_hash_table_iter_remove (&iter);
+              dropped++;
+            }
         }
+
+      GSK_NOTE(GLYPH_CACHE, if (dropped > 0) g_message ("Dropped %d icons", dropped));
     }
 
   if (self->timestamp % MAX_FRAME_AGE == 0)
@@ -102,6 +109,8 @@ gsk_gl_icon_cache_begin_frame (GskGLIconCache *self,
 
           icon_data->accessed = FALSE;
         }
+
+      GSK_NOTE(GLYPH_CACHE, g_message ("%d icons cached", g_hash_table_size (self->icons)));
     }
 }
 
diff --git a/gsk/gl/gskgltextureatlas.c b/gsk/gl/gskgltextureatlas.c
index 3349d06cf7..cd382a80ae 100644
--- a/gsk/gl/gskgltextureatlas.c
+++ b/gsk/gl/gskgltextureatlas.c
@@ -87,7 +87,7 @@ gsk_gl_texture_atlases_begin_frame (GskGLTextureAtlases *self,
         {
           GSK_NOTE(GLYPH_CACHE,
                    g_message ("Dropping atlas %d (%g.2%% old)", i,
-                              gsk_gl_texture_atlas_get_unused_ratio (atlas)));
+                              100.0 * gsk_gl_texture_atlas_get_unused_ratio (atlas)));
 
           if (atlas->texture_id != 0)
             {
@@ -100,6 +100,8 @@ gsk_gl_texture_atlases_begin_frame (GskGLTextureAtlases *self,
        }
     }
 
+  GSK_NOTE(GLYPH_CACHE, if (removed->len > 0) g_message ("%d atlases left", self->atlases->len));
+
 #if 0
   {
     static guint timestamp;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]