#ifdef DEBUG_LOAD_TIME
struct timeval load_start;
struct timeval load_finish;
+ int load_time;
+ int saved_time;
#endif
};
static int max_font_usage = 10 * 4 * 1024; /* in kbytes */
static int font_mem_usage = 0;
+#ifdef DEBUG_LOAD_TIME
+static int
+_timeval_sub(const struct timeval *tv2, const struct timeval *tv1)
+{
+ int t1, t2;
+
+ t1 = tv1->tv_usec + tv1->tv_sec * 1000000;
+ t2 = tv2->tv_usec + tv2->tv_sec * 1000000;
+
+ // Make sure that we don't add negative values. Some images may have
+ // been not loaded yet, so it would mess with the stats.
+ if (t2 > t1)
+ return t2 - t1;
+
+ return 0;
+}
+#endif
+
static inline void
_entry_load_start(Entry *e)
{
{
#ifdef DEBUG_LOAD_TIME
gettimeofday(&e->load_finish, NULL);
+ e->load_time = _timeval_sub(&e->load_finish, &e->load_start);
#endif
}
-#ifdef DEBUG_LOAD_TIME
-static int
-_timeval_sub(const struct timeval *tv2, const struct timeval *tv1)
+static inline void
+_entry_load_reused(Entry *e)
{
- int t1, t2;
-
- t1 = tv1->tv_usec + tv1->tv_sec * 1000000;
- t2 = tv2->tv_usec + tv2->tv_sec * 1000000;
-
- // Make sure that we don't add negative values. Some images may have
- // been not loaded yet, so it would mess with the stats.
- if (t2 > t1)
- return t2 - t1;
-
- return 0;
-}
+#ifdef DEBUG_LOAD_TIME
+ e->saved_time += e->load_time;
#endif
+}
static void
_image_opened_send(Client *client, File_Data *entry, unsigned int rid)
{
Waiter *w;
- _entry_load_start(&e->base);
+ _entry_load_finish(&e->base);
e->alpha_sparse = resp->alpha_sparse;
if (!e->doload)
Font_Entry *fe = data;
Msg_Stats *msg = fdata;
Font_Cache *fc;
- int load_time;
int nrefs = eina_list_count(fe->base.references);
msg->fonts.fonts_loaded++;
#ifdef DEBUG_LOAD_TIME
// accounting fonts load time
- load_time = _timeval_sub(&fe->base.load_finish, &fe->base.load_start);
- msg->fonts.fonts_load_time += load_time;
- if (fe->caches) msg->fonts.fonts_used_load_time += load_time;
+ msg->fonts.fonts_load_time += fe->base.load_time;
+ if (fe->caches)
+ {
+ msg->fonts.fonts_used_load_time += fe->base.load_time;
+ msg->fonts.fonts_used_saved_time += fe->base.saved_time;
+ }
// accounting glyphs load time
msg->fonts.glyphs_load_time += fe->gl_load_time;
(sizeof(Request) + sizeof(Eina_List *));
#ifdef DEBUG_LOAD_TIME
- int load_time;
// accounting file entries load time
- load_time = _timeval_sub(&fd->base.load_finish, &fd->base.load_start);
- msg->images.files_load_time += load_time;
+ msg->images.files_load_time += fd->base.load_time;
+ msg->images.files_saved_time += fd->base.saved_time;
#endif
return EINA_TRUE;
(image_size * eina_list_count(id->base.references));
#ifdef DEBUG_LOAD_TIME
- int load_time;
// accounting image entries load time
- load_time = _timeval_sub(&id->base.load_finish, &id->base.load_start);
- if (load_time > 0)
- msg->images.images_load_time += load_time;
+ msg->images.images_load_time += id->base.load_time;
+ msg->images.images_saved_time += id->base.saved_time;
#endif
return EINA_TRUE;
if (ref)
{
entry = (File_Data *)ref->entry;
+ _entry_load_reused(ref->entry);
if (entry->invalid)
{
return -1;
}
ref = _entry_reference_add((Entry *)entry, client, client_file_id);
+ _entry_load_reused(ref->entry);
eina_hash_add(client->files.referencing, &client_file_id, ref);
if (entry->base.request)
_request_answer_add(entry->base.request, ref, rid, CSERVE2_OPEN);
image_entries_lru = eina_list_remove(image_entries_lru, entry);
unused_mem_usage -= _image_entry_size_get(entry);
}
+ _entry_load_reused(&entry->base);
if (oldref && (oldref->entry->id == image_id))
return 0;
client->fonts.referencing = eina_list_append(
client->fonts.referencing, ref);
+ _entry_load_reused(&fe->base);
fe->unused = EINA_FALSE;
if (fe->request)
printf("Image data usage: %d kbytes\n", msg->images.images_size / 1024);
printf("Image data unused: %d kbytes\n", msg->images.unused_size / 1024);
printf("Image headers load time: %dus\n", msg->images.files_load_time);
+ printf("Image headers saved time: %dus\n", msg->images.files_saved_time);
printf("Image data load time: %dus\n", msg->images.images_load_time);
- printf("Glyphs load time: %dus\n", msg->fonts.glyphs_load_time);
+ printf("Image data saved time: %dus\n", msg->images.images_saved_time);
printf("\nFont Usage Statistics:\n");
printf("----------------------\n\n");
printf("Requested usage: %d bytes\n", msg->fonts.requested_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("Fonts used saved time: %dus\n", msg->fonts.fonts_used_saved_time);
printf("Glyphs load time: %dus\n", msg->fonts.glyphs_load_time);
printf("\n");