evas/cserve2: Calculate average time saved on glyph

rendering.



SVN revision: 72829
This commit is contained in:
Rafael Antognolli 2012-06-25 20:06:50 +00:00
parent 2234422dab
commit a6a92632b0
3 changed files with 17 additions and 0 deletions

View File

@ -111,6 +111,7 @@ struct _Font_Entry {
Font_Source *src; Font_Source *src;
void *ft; void *ft;
Fash_Glyph2 *glyphs; Fash_Glyph2 *glyphs;
unsigned int nglyphs;
Eina_Inlist *caches; Eina_Inlist *caches;
Font_Cache *last_cache; Font_Cache *last_cache;
Eina_Bool unused : 1; Eina_Bool unused : 1;
@ -118,6 +119,7 @@ struct _Font_Entry {
struct timeval load_start; struct timeval load_start;
struct timeval load_finish; struct timeval load_finish;
int gl_load_time; int gl_load_time;
int gl_saved_time;
#endif #endif
}; };
@ -1389,6 +1391,11 @@ _glyphs_request_check(Glyphs_Request *req)
if (ge) if (ge)
{ {
req->answer[req->nanswer++] = 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++; ge->fc->inuse++;
} }
else else
@ -1630,6 +1637,12 @@ _glyphs_load_request_prepare(Glyphs_Request *req)
if (ge) if (ge)
{ {
req->answer[req->nanswer++] = 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++; ge->fc->inuse++;
} }
else else
@ -1726,6 +1739,7 @@ _glyphs_load_request_response(Client *client __UNUSED__, void *data, void *resp,
font_mem_usage += sizeof(*gl); font_mem_usage += sizeof(*gl);
fc->glyphs = eina_inlist_append(fc->glyphs, EINA_INLIST_GET(gl)); fc->glyphs = eina_inlist_append(fc->glyphs, EINA_INLIST_GET(gl));
fc->nglyphs++; fc->nglyphs++;
fe->nglyphs++;
fash_gl_add(fe->glyphs, gl->index, gl); fash_gl_add(fe->glyphs, gl->index, gl);
req->answer[req->nanswer++] = gl; req->answer[req->nanswer++] = gl;
gl->fc->inuse++; gl->fc->inuse++;
@ -1800,6 +1814,7 @@ _font_entry_stats_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED_
// accounting glyphs load time // accounting glyphs load time
msg->fonts.glyphs_load_time += fe->gl_load_time; msg->fonts.glyphs_load_time += fe->gl_load_time;
msg->fonts.glyphs_saved_time += fe->gl_saved_time;
#endif #endif
return EINA_TRUE; return EINA_TRUE;

View 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 load time: %dus\n", msg->fonts.fonts_used_load_time);
printf("Fonts used saved time: %dus\n", msg->fonts.fonts_used_saved_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 load time: %dus\n", msg->fonts.glyphs_load_time);
printf("Glyphs saved time: %dus\n", msg->fonts.glyphs_saved_time);
printf("\n"); printf("\n");
} }

View File

@ -211,6 +211,7 @@ struct _Msg_Stats {
* rendered */ * rendered */
int fonts_used_saved_time; int fonts_used_saved_time;
int glyphs_load_time; /* total time spent loading glyphs */ int glyphs_load_time; /* total time spent loading glyphs */
int glyphs_saved_time; /* total time spent loading glyphs */
} fonts; } fonts;
struct { struct {
unsigned int files_loaded; /* number of file headers loaded */ unsigned int files_loaded; /* number of file headers loaded */