evas/cserve2: Calculate average time saved on glyph
authorantognolli <antognolli@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 25 Jun 2012 20:06:50 +0000 (20:06 +0000)
committerantognolli <antognolli@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 25 Jun 2012 20:06:50 +0000 (20:06 +0000)
 rendering.

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

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

index f791d59..579a6ab 100644 (file)
@@ -111,6 +111,7 @@ struct _Font_Entry {
    Font_Source *src;
    void *ft;
    Fash_Glyph2 *glyphs;
+   unsigned int nglyphs;
    Eina_Inlist *caches;
    Font_Cache *last_cache;
    Eina_Bool unused : 1;
@@ -118,6 +119,7 @@ struct _Font_Entry {
    struct timeval load_start;
    struct timeval load_finish;
    int gl_load_time;
+   int gl_saved_time;
 #endif
 };
 
@@ -1389,6 +1391,11 @@ _glyphs_request_check(Glyphs_Request *req)
         if (ge)
           {
              req->answer[req->nanswer++] = ge;
+#ifdef DEBUG_LOAD_TIME
+             // calculate average time saved when loading glyphs
+             fe->gl_saved_time +=
+                (fe->gl_load_time / fe->nglyphs);
+#endif
              ge->fc->inuse++;
           }
         else
@@ -1630,6 +1637,12 @@ _glyphs_load_request_prepare(Glyphs_Request *req)
         if (ge)
           {
              req->answer[req->nanswer++] = ge;
+
+#ifdef DEBUG_LOAD_TIME
+             // calculate average time saved when loading glyphs
+             fe->gl_saved_time +=
+                (fe->gl_load_time / fe->nglyphs);
+#endif
              ge->fc->inuse++;
           }
         else
@@ -1726,6 +1739,7 @@ _glyphs_load_request_response(Client *client __UNUSED__, void *data, void *resp,
              font_mem_usage += sizeof(*gl);
              fc->glyphs = eina_inlist_append(fc->glyphs, EINA_INLIST_GET(gl));
              fc->nglyphs++;
+             fe->nglyphs++;
              fash_gl_add(fe->glyphs, gl->index, gl);
              req->answer[req->nanswer++] = gl;
              gl->fc->inuse++;
@@ -1800,6 +1814,7 @@ _font_entry_stats_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED_
 
    // accounting glyphs load time
    msg->fonts.glyphs_load_time += fe->gl_load_time;
+   msg->fonts.glyphs_saved_time += fe->gl_saved_time;
 #endif
 
    return EINA_TRUE;
index 9691824..e8307e3 100644 (file)
@@ -215,6 +215,7 @@ _usage_msg_read(void)
    printf("Fonts used load time: %dus\n", msg->fonts.fonts_used_load_time);
    printf("Fonts used saved time: %dus\n", msg->fonts.fonts_used_saved_time);
    printf("Glyphs load time: %dus\n", msg->fonts.glyphs_load_time);
+   printf("Glyphs saved time: %dus\n", msg->fonts.glyphs_saved_time);
 
    printf("\n");
 }
index 77c4e44..938ea5f 100644 (file)
@@ -211,6 +211,7 @@ struct _Msg_Stats {
                                  * rendered */
       int fonts_used_saved_time;
       int glyphs_load_time; /* total time spent loading glyphs */
+      int glyphs_saved_time; /* total time spent loading glyphs */
    } fonts;
    struct {
       unsigned int files_loaded; /* number of file headers loaded */