int main(void) { Eina_List *fonts; Font_Entry *fe; Msg_Index_List *msg = NULL; int size; eina_init(); _evas_cserve2_debug_log_dom = eina_log_domain_register ("evas_cserve2_debug", EINA_COLOR_BLUE); if (!_server_connect()) { ERR("Could not connect to server."); return -1; } while (!msg) msg = _server_read(&size); _shared_index_print(msg, size); _debug_msg_send(); fonts = _debug_msg_read(); EINA_LIST_FREE(fonts, fe) { _font_entry_print(fe); _font_entry_free(fe); }
static void _usage_msg_read(void) { Msg_Stats *stats = NULL; int size; printf("Requesting server statistics.\n\n"); while (!stats) { Msg_Base *msg = _server_read(&size); if (!msg) continue; switch (msg->type) { case CSERVE2_INDEX_LIST: _shared_index_print(msg, size); break; case CSERVE2_STATS: stats = (Msg_Stats *) msg; break; default: ERR("Invalid message received from server. " "Something went badly wrong."); return; } } printf("Printing server usage.\n"); printf("======================\n\n"); printf("\nImage Usage Statistics:\n"); printf("----------------------\n\n"); printf("Image headers usage: %d bytes\n", stats->images.files_size); printf("Image data requested: %d kbytes\n", stats->images.requested_size / 1024); printf("Image data usage: %d kbytes\n", stats->images.images_size / 1024); printf("Image data unused: %d kbytes\n", stats->images.unused_size / 1024); printf("Image headers load time: %dus\n", stats->images.files_load_time); printf("Image headers saved time: %dus\n", stats->images.files_saved_time); printf("Image data load time: %dus\n", stats->images.images_load_time); printf("Image data saved time: %dus\n", stats->images.images_saved_time); printf("\nFont Usage Statistics:\n"); printf("----------------------\n\n"); printf("Requested usage: %d bytes\n", stats->fonts.requested_size); printf("Real usage: %d bytes\n", stats->fonts.real_size); printf("Unused size: %d bytes\n", stats->fonts.unused_size); printf("Fonts load time: %dus\n", stats->fonts.fonts_load_time); printf("Fonts used load time: %dus\n", stats->fonts.fonts_used_load_time); printf("Fonts used saved time: %dus\n", stats->fonts.fonts_used_saved_time); printf("Glyphs load time: %dus\n", stats->fonts.glyphs_load_time); printf("Glyphs render time: %dus\n", stats->fonts.glyphs_render_time); printf("Glyphs saved time: %dus\n", stats->fonts.glyphs_saved_time); printf("Glyphs request time: %dus\n", stats->fonts.glyphs_request_time); printf("Glyphs slave time: %dus\n", stats->fonts.glyphs_slave_time); printf("\n"); }