evas/cserve2: Rename some stats and add some more for font
authorantognolli <antognolli@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 22 Jun 2012 21:43:50 +0000 (21:43 +0000)
committerantognolli <antognolli@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 22 Jun 2012 21:43:50 +0000 (21:43 +0000)
 loading.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@72704 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/evas_cserve2_cache.c
src/bin/evas_cserve2_usage.c
src/lib/cserve2/evas_cs2.h

index cc9ed93..b8826cf 100644 (file)
@@ -1752,27 +1752,35 @@ _font_entry_stats_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED_
    int load_time;
    int nrefs = eina_list_count(fe->base.references);
 
+   msg->fonts.fonts_loaded++;
+   if (fe->unused) msg->fonts.fonts_unused++;
+
    // accounting size
    EINA_INLIST_FOREACH(fe->caches, fc)
      {
+        unsigned int fc_usage, shmsize;
         /* This is not real requested usage, but an approximation. We don't
          * know how many times each glyph would be used by each client, but
          * assume that a similar set of glyphs from a given font would be used
          * by each client, thus counting them one time per client referencing
          * them.
          */
-        msg->fonts.requested_usage += fc->usage * nrefs;
-        msg->fonts.real_usage += cserve2_shm_size_get(fc->shm);
+        fc_usage = fc->usage * nrefs;
+        shmsize = cserve2_shm_size_get(fc->shm);
+
+        msg->fonts.requested_size += fc_usage;
+        msg->fonts.real_size += shmsize;
+        if (fe->unused) msg->fonts.unused_size += shmsize;
      }
 
 #ifdef DEBUG_LOAD_TIME
    // accounting fonts load time
    load_time = _timeval_sub(&fe->base.load_finish, &fe->base.load_start);
-   msg->fonts.fonts_load += load_time;
-   if (fe->caches) msg->fonts.fonts_used_load += load_time;
+   msg->fonts.fonts_load_time += load_time;
+   if (fe->caches) msg->fonts.fonts_used_load_time += load_time;
 
    // accounting glyphs load time
-   msg->fonts.glyphs_load += fe->gl_load_time;
+   msg->fonts.glyphs_load_time += fe->gl_load_time;
 #endif
 
    return EINA_TRUE;
index fcf6720..dd1cdb0 100644 (file)
@@ -197,11 +197,13 @@ _usage_msg_read(void)
    printf("Printing server usage.\n");
    printf("======================\n\n");
    printf("Font Usage Statistics:\n");
-   printf("Requested usage: %d bytes\n", msg->fonts.requested_usage);
-   printf("Real usage: %d bytes\n", msg->fonts.real_usage);
-   printf("Fonts load time: %dus\n", msg->fonts.fonts_load);
-   printf("Fonts used load time: %dus\n", msg->fonts.fonts_used_load);
-   printf("Glyphs load time: %dus\n", msg->fonts.glyphs_load);
+   printf("----------------------\n\n");
+   printf("Requested usage: %d bytes\n", msg->fonts.requested_size);
+   printf("Real usage: %d bytes\n", msg->fonts.real_size);
+   printf("Unused size: %d bytes\n", msg->fonts.unused_size);
+   printf("Fonts load time: %dus\n", msg->fonts.fonts_load_time);
+   printf("Fonts used load time: %dus\n", msg->fonts.fonts_used_load_time);
+   printf("Glyphs load time: %dus\n", msg->fonts.glyphs_load_time);
 
    printf("\n");
 }
index d58b866..6eabfc6 100644 (file)
@@ -199,12 +199,17 @@ struct _Msg_Font_Glyphs_Loaded {
 struct _Msg_Stats {
    Msg_Base base;
    struct {
-      unsigned int requested_usage;
-      unsigned int real_usage;
-      int fonts_load; // total time spent loading fonts
-      int fonts_used_load; // total time spent loading fonts that are
-                           // really used
-      int glyphs_load; // total time spent loading glyphs
+      unsigned int requested_size;
+      unsigned int real_size;
+      unsigned int unused_size;
+      unsigned int fonts_loaded; /* number of loaded fonts */
+      unsigned int fonts_unused; /* number of loaded fonts without reference
+                                  * from any clients */
+      int fonts_load_time; /* total time spent loading fonts */
+      int fonts_used_load_time; /* total time spent loading fonts that are
+                                 * really used, i.e. fonts that have glyphs
+                                 * rendered */
+      int glyphs_load_time; /* total time spent loading glyphs */
    } fonts;
 };