containing ui setup steps in the profiling again.
[platform/upstream/expedite.git] / src / bin / ui.c
1 #include "main.h"
2
3 #include <Eo.h>
4
5 #define PROTO
6 #include "tests.h"
7 #undef PROTO
8
9 static double wfps = 0.0;
10
11 static double t_start = 0.0;
12 static double t_loop = 0.0;
13 static int    f_start = 0;
14 static int    f_loop = 0;
15
16 int async_render = 0;
17 Eina_List *menu = NULL;
18
19 static Evas_Object *o_bg = NULL;
20 static Evas_Object *o_wallpaper = NULL;
21 static Evas_Object *o_title = NULL;
22 static Evas_Object *o_byline = NULL;
23 static Evas_Object *o_menu_logo = NULL;
24 static Evas_Object *o_menu_icon_sel = NULL;
25 static Evas_Object *o_menu_icon_sel2 = NULL;
26 static Evas_Object *o_menu_text_sel = NULL;
27 static Evas_Object *o_menu_title = NULL;
28 static int          menu_sel = 0;
29 static int          menu_active = 0;
30 static double       menu_anim = 0.0;
31 static double       menu_anim_sel = 0.0;
32
33 static double       p_fps = 0.0;
34
35 static void (*key_func) (const char *key) = NULL;
36 static void (*loop_func) (double t, int f) = NULL;
37
38 double weights[] =
39 {
40    0.0, // no test 0
41    0.0, // all tests 0
42
43    50.4851, // test 1
44    97.3703, // test 2
45    10.0000, // test 3
46    87.3703, // ...
47    10.0000,
48
49    150.0000, // test 6
50    10.0000,
51    150.0000,
52    10.0000,
53    150.0000,
54
55    10.0000, // test 11
56    150.0000,
57    10.0000,
58    10.6493,
59    38.4818,
60
61    40.7314, // test 16
62    32.0866,
63    21.3337,
64    21.2167,
65    71.6141,
66
67    64.8893, // test 21
68    95.0880,
69    121.0438,
70    41.2646,
71    162.7149,
72
73    89.1650, // test 26
74    105.3571,
75    40.9657,
76    98.4671,
77    28.4322,
78
79    60.000, // test 31
80    75.5507,
81    51.6601,
82    135.4753,
83    38.2705,
84
85    35.9915, // test 36
86    31.9500,
87    22.6752,
88    38.2702,
89    37.4459,
90
91    37.2009, // test 41
92    34.5459,
93    38.5043,
94    50.0000,
95    37.0282,
96
97    55.8886, // test 46
98    17.2535,
99    23.1457,
100    36.9874,
101    37.9336,
102
103    17.1830, // test 51
104    20.7521,
105    29.0141,
106    131.6784,
107    13.6851,
108
109    23.4462, // test 56
110    14.7573,
111    36.5261,
112    5.0000,
113    5.0000,
114
115    24.3482, // test 61
116    10.4611,
117    86.0290,
118    82.0735,
119    18.6459,
120
121    37.4608, // test 66
122    32.4417,
123    11.5449,
124    5.0000,
125    11.4172,
126
127    13.3682, // test 71
128    10.0324,
129    10.0584,
130    10.0170,
131    5.4029,
132
133    10.6349, // test 76
134    21.7728,
135    12.7933,
136    19.4177,
137    34.4192,
138
139    23.9110, // test 81
140    22.8287,
141    41.2399,
142    30.1383,
143    22.0342,
144
145    38.2952, // test 86
146    5.5560,
147    0.5000,
148    1.000,
149    10.000,
150
151    5.000, // test 91
152    1.000, // test 92 (line)
153    10.000, // test 93 Image Blend Many Smooth Down Scaled
154
155    20.000, // MASK
156    20.000, // MASK 2
157    20.000, // MASK 3
158    20.000, // MASK 4
159
160    20.000, // test 96
161    20.000, // MASK 6
162    20.000, // MASK 7
163    20.000, // MASK 8
164    20.000, // MASK 9
165
166    20.000, // test 101
167    20.000, // MASK 11
168    20.000, // MASK 12
169    20.000, // MASK 13
170    20.000, // MASK 14
171
172    20.000, // test 106 MASK 15
173    1.000,
174    2.000,
175    1.000,
176    2.000,
177
178    1.000, // test 111
179    2.000,
180    1.000,
181    2.000,
182    1.000,
183
184    2.000,   // test 116
185    10.000,
186    10.000,
187
188    0.0, // Exit
189
190    0.0, // no final test - add a 0 at the end anyway to pad
191    0.0,
192    0.0,
193    0.0,
194    0.0,
195    0.0
196 };
197
198 static void
199 _ui_exit(void)
200 {
201    Menu_Item *mi;
202
203    EINA_LIST_FREE(menu, mi)
204      {
205         free(mi->icon);
206         free(mi->text);
207         free(mi);
208      }
209    ecore_main_loop_quit();
210 }
211
212 extern const char *profile;
213 extern int win_w, win_h;
214 extern int loops;
215
216 static int test_item = -1;
217
218 static void
219 _ui_menu_show(Eina_Bool visibility)
220 {
221    efl_gfx_entity_visible_set(o_menu_logo, visibility);
222    efl_gfx_entity_visible_set(o_menu_title, visibility);
223    efl_gfx_entity_visible_set(o_menu_icon_sel, visibility);
224    /* FIXME: ask if it's ok o_menu_icon_sel2 == NULL */
225    efl_gfx_entity_visible_set(o_menu_icon_sel2, visibility);
226    efl_gfx_entity_visible_set(o_menu_text_sel, visibility);
227    efl_gfx_entity_visible_set(o_title, visibility);
228    efl_gfx_entity_visible_set(o_byline, visibility);
229 }
230
231 static void
232 _ui_select(void)
233 {
234    Eina_List *l;
235    int i;
236    void (*func) (void) = NULL;
237
238    _ui_menu_show(EINA_FALSE);
239    for (i = 0, l = menu; l; l = l->next, i++)
240      {
241         Menu_Item *mi;
242
243         mi = l->data;
244         efl_gfx_entity_visible_set(mi->o_icon, EINA_FALSE);
245         if (i == menu_sel)
246           func = mi->func;
247      }
248    efl_gfx_entity_visible_set(o_title, EINA_FALSE);
249    efl_gfx_entity_visible_set(o_byline, EINA_FALSE);
250
251    menu_active = 0;
252    if (func) func();
253 }
254
255 static void
256 _ui_key(void *data EINA_UNUSED, const Efl_Event *event)
257 {
258    Efl_Input_Key *ev = event->info;
259    const char *keyname = efl_input_key_name_get(ev);
260
261    if (!keyname) return;
262
263    if (key_func)
264      {
265         key_func(keyname);
266         return;
267      }
268
269    if ((!strcmp(keyname, "Escape")) ||
270        (!strcmp(keyname, "q")) ||
271        (!strcmp(keyname, "Q")))
272      {
273         _ui_exit();
274         return;
275      }
276
277    if (menu_active)
278      {
279         if (!strcmp(keyname, "Left")) menu_sel++;
280         else if (!strcmp(keyname, "Right")) menu_sel--;
281         else if (!strcmp(keyname, "Up")) menu_sel++;
282         else if (!strcmp(keyname, "Down")) menu_sel--;
283         else if (!strcmp(keyname, "Home")) menu_sel = eina_list_count(menu) - 1;
284         else if (!strcmp(keyname, "End")) menu_sel = 0;
285         else if (!strcmp(keyname, "Next")) menu_sel -= 10;
286         else if (!strcmp(keyname, "Prior")) menu_sel += 10;
287         if (menu_sel < 0) menu_sel = 0;
288         else if ((unsigned int)menu_sel >= eina_list_count(menu)) menu_sel = eina_list_count(menu) - 1;
289         menu_anim_sel = menu_sel;
290         if (!strcmp(keyname, "Return")) _ui_select();
291      }
292 }
293
294 static Eina_Position2D down;
295 static int down_menu_sel = 0;
296
297 //FIXME: efl_input_pointer_button_get() doesn't work!
298 static Eina_Bool mdown = EINA_FALSE;
299
300 static void
301 _ui_mouse_down(void *data EINA_UNUSED, const Efl_Event *event)
302 {
303    Efl_Input_Pointer *ev = event->info;
304
305    if (efl_input_pointer_button_get(ev) != 1) return;
306    if (menu_active)
307      {
308         down = efl_input_pointer_position_get(ev);
309         down_menu_sel = menu_sel;
310         mdown = EINA_TRUE;
311      }
312 }
313
314 static void
315 _ui_mouse_up(void *data EINA_UNUSED, const Efl_Event *event)
316 {
317    Efl_Input_Pointer *ev = event->info;
318
319    if (efl_input_pointer_button_get(ev) != 1) return;
320    if (menu_active)
321      {
322         Evas_Coord dx, dy, x, y;
323
324         exp_input_pointer_pos_get(ev, &x, &y);
325         dx = x - down.x;
326         dy = y - down.y;
327         if ((((dx * dx) + (dy * dy)) < (20 * 20)) &&
328             (menu_sel == down_menu_sel))
329           _ui_select();
330         mdown = EINA_FALSE;
331      }
332    else
333      {
334         evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
335         evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
336      }
337 }
338
339 static void
340 _ui_mouse_move(void *data EINA_UNUSED, const Efl_Event *event)
341 {
342    Efl_Input_Pointer *ev = event->info;
343
344    /* FIXME: This mdown should be replace with the original call
345       if (efl_input_pointer_button_get(ev) != 1) return; */
346    if (!mdown) return;
347
348    if (menu_active)
349      {
350         Evas_Coord x;
351
352         exp_input_pointer_pos_get(ev, &x, NULL);
353         menu_sel = down_menu_sel + ((x - down.x) / 25);
354         /* scroll */
355         if (menu_sel < 0) menu_sel = 0;
356         else if ((unsigned int)menu_sel >= eina_list_count(menu))
357           menu_sel = eina_list_count(menu) - 1;
358         menu_anim_sel = menu_sel;
359      }
360 }
361
362 static void
363 _ui_menu_item_full_add(Eina_Bool test,
364                        char *icon, char *text,
365                        void (*func) (void))
366 {
367    Menu_Item *mi;
368
369    mi = malloc(sizeof(Menu_Item));
370    mi->o_icon = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
371    efl_file_simple_load(mi->o_icon, build_path(icon), NULL);
372    efl_gfx_entity_size_set(mi->o_icon, EINA_SIZE2D(32, 32));
373    efl_gfx_fill_set(mi->o_icon, EINA_RECT(0, 0, 32, 32));
374    mi->test = test;
375    mi->icon = strdup(icon);
376    mi->text = strdup(text);
377    mi->func = func;
378    menu = eina_list_append(menu, mi);
379    efl_gfx_stack_raise_to_top(o_menu_icon_sel2);
380 }
381
382 #define _ui_menu_item_add(Icon, Text, Func) _ui_menu_item_full_add(EINA_TRUE, Icon, Text, Func)
383
384 EFL_CALLBACKS_ARRAY_DEFINE(ui_callbacks,
385                            { EFL_EVENT_KEY_DOWN, _ui_key },
386                            { EFL_EVENT_POINTER_DOWN, _ui_mouse_down },
387                            { EFL_EVENT_POINTER_UP, _ui_mouse_up },
388                            { EFL_EVENT_POINTER_MOVE, _ui_mouse_move });
389
390 void
391 ui_setup(unsigned int ui_w, unsigned int ui_h)
392 {
393    Evas_Object *o;
394    Evas_Coord x, y, w, h;
395
396    win_w = ui_w;
397    win_h = ui_h;
398
399    o = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas);
400    efl_gfx_entity_position_set(o, EINA_POSITION2D(0, 0));
401    efl_gfx_entity_size_set(o, EINA_SIZE2D(win_w, win_h));
402    efl_gfx_color_set(o, 0, 0, 0, 0);
403    efl_gfx_stack_layer_set(o, 1000);
404    evas_object_focus_set(o, 1);
405    efl_gfx_entity_visible_set(o, EINA_TRUE);
406    efl_event_callback_array_add(o, ui_callbacks(), NULL);
407    o_bg = o;
408
409    o = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas);
410    efl_gfx_entity_position_set(o, EINA_POSITION2D(0, 0));
411    efl_gfx_entity_size_set(o, EINA_SIZE2D(win_w, win_h));
412    efl_gfx_color_set(o, 255, 255, 255, 255);
413    efl_gfx_stack_layer_set(o, -99);
414    efl_gfx_entity_visible_set(o, EINA_TRUE);
415    o_wallpaper = o;
416
417    o = evas_object_text_add(evas);
418 #if 0
419    efl_text_font_family_set(o, "Vera-Bold");
420    efl_text_font_size_set(o, 10);
421    efl_text_set(o, "EXPEDITE");
422 #else
423    evas_object_text_font_set(o, "Vera-Bold", 10);
424    evas_object_text_text_set(o, "EXPEDITE");
425 #endif
426    efl_gfx_stack_layer_set(o, 100);
427    efl_gfx_color_set(o, 0, 0, 0, 100);
428    evas_object_pass_events_set(o, 1);
429    exp_size_get(o, &w, &h);
430    x = (win_w - w) / 2;
431    y = 0;
432    efl_gfx_entity_position_set(o, EINA_POSITION2D(x, y));
433    efl_gfx_entity_visible_set(o, EINA_TRUE);
434    o_title = o;
435
436    o = evas_object_text_add(evas);
437 #if 0
438    efl_text_font_family_set(o, "Vera");
439    efl_text_font_size_set(o, 9);
440    efl_text_set(o, "LEFT/RIGHT - select, ENTER - select, ESCAPE - exit.");
441 #else
442    evas_object_text_font_set(o, "Vera", 9);
443    evas_object_text_text_set(o, "LEFT/RIGHT - select, ENTER - select, ESCAPE - exit.");
444 #endif
445    efl_gfx_stack_layer_set(o, 100);
446    efl_gfx_color_set(o, 0, 0, 0, 60);
447    evas_object_pass_events_set(o, 1);
448    exp_size_get(o, &w, NULL);
449    x = (win_w - w) / 2;
450    y = h + 2;
451    efl_gfx_entity_position_set(o, EINA_POSITION2D(x, y));
452    efl_gfx_entity_visible_set(o, EINA_TRUE);
453    o_byline = o;
454
455    o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
456    efl_gfx_entity_position_set(o, EINA_POSITION2D((win_w - 120) / 2, ((win_h - 160) / 2)));
457    efl_file_simple_load(o, build_path("e-logo.png"), NULL);
458    efl_gfx_fill_set(o, EINA_RECT(0, 0, 120, 160));
459    efl_gfx_entity_size_set(o, EINA_SIZE2D(120, 160));
460    efl_gfx_stack_layer_set(o, -98);
461    efl_gfx_color_set(o, 255, 255, 255, 255);
462    efl_gfx_entity_visible_set(o, EINA_TRUE);
463    o_menu_logo = o;
464
465    o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
466    efl_gfx_entity_position_set(o, EINA_POSITION2D(0, 0));
467    efl_file_simple_load(o, build_path("icon_sel.png"), NULL);
468    efl_gfx_entity_size_set(o, EINA_SIZE2D(48, 48));
469    efl_gfx_fill_set(o, EINA_RECT(0, 0, 48, 48));
470    o_menu_icon_sel = o;
471
472    o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
473    efl_gfx_entity_position_set(o, EINA_POSITION2D(0, 0));
474    efl_file_simple_load(o, build_path("text_sel.png"), NULL);
475    efl_gfx_entity_size_set(o, EINA_SIZE2D(96, 32));
476    efl_gfx_fill_set(o, EINA_RECT(0, 0, 96, 32));
477    efl_gfx_image_border_insets_set(o, 7, 7, 7, 7);
478    o_menu_text_sel = o;
479
480    o = evas_object_text_add(evas);
481 #if 0
482    efl_text_font_family_set(o, "Vera");
483    efl_text_font_size_set(o, 10);
484    efl_text_set(o, "");
485 #else
486    evas_object_text_font_set(o, "Vera", 10);
487    evas_object_text_text_set(o, "");
488 #endif
489    efl_gfx_color_set(o, 0, 0, 0, 100);
490    evas_object_pass_events_set(o, 1);
491    exp_size_get(o, &w, &h);
492    x = (win_w - w) / 2;
493    y = (win_h - h) / 2;
494    efl_gfx_entity_position_set(o, EINA_POSITION2D(x, y));
495    o_menu_title = o;
496
497    _ui_menu_item_full_add(EINA_FALSE, "e.png", "About", about_start);
498    _ui_menu_item_full_add(EINA_FALSE, "e.png", "All Tests", ui_all);
499 #define UI
500 #include "tests.h"
501 #undef UI
502    _ui_menu_item_full_add(EINA_FALSE, "exit.png", "Exit", _ui_exit);
503
504 #ifdef HAVE_SYNC
505    /* make sure disk io isn't going to turn up unexpectedly */
506    sync();
507    sync();
508    sync();
509 #endif
510    
511    printf("\n#####Test Start#####\n"
512           "profile: %s\n"
513           "window size: %i, %i\n"
514           "loop count: %i\n"
515           "engine: %s\n",
516           profile,
517           win_w, win_h,
518           loops,
519           choosen_engine);
520
521    menu_active = 1;
522 }
523
524 void
525 ui_num(int n)
526 {
527    Menu_Item *mi;
528
529    mi = eina_list_nth(menu, n);
530    if (mi)
531      {
532         if (!mi->test)
533           return;
534         menu_sel = n;
535         if (one_test) test_item = menu_sel;
536         _ui_select();
537      }
538 }
539
540 Eina_Bool
541 ui_loop(void *data EINA_UNUSED)
542 {
543    static int first = 1;
544    static double pt = 0.0;
545    double t, t2;
546
547    efl_gfx_entity_size_set(o_bg, EINA_SIZE2D(win_w, win_h));
548    efl_gfx_entity_size_set(o_wallpaper, EINA_SIZE2D(win_w, win_h));
549
550    if (loop_func)
551      {
552         t = get_time();
553         f_loop++;
554         f_start++;
555         if ((t - t_loop) >= 1.0)
556           {
557              //      ui_fps((double)f_loop / (t - t_loop));
558              t_loop = t;
559              f_loop = 0;
560           }
561         loop_func(t - t_start, f_start);
562         return EINA_TRUE;
563      }
564
565    t2 = get_time();
566    if (first)
567      {
568         t = 0.1;
569         pt = t2;
570      }
571    else
572      {
573         t = t2 - pt;
574         pt = t2;
575      }
576    first = 0;
577
578    /* menu layout */
579    if (menu_active)
580      {
581         Eina_List *l;
582         Menu_Item *mi;
583         int i = 0;
584         static double tr = 0.0;
585         double tt;
586
587         tt = t;
588         tt += tr;
589         while (tt > 0.001)
590           {
591              menu_anim = (menu_anim * 0.995) + (menu_anim_sel * 0.005);
592              tt -= 0.001;
593           }
594         tr = tt;
595         EINA_LIST_FOREACH(menu, l, mi)
596           {
597              Evas_Coord x, y, w, h, tw, th;
598              Evas_Coord len;
599              double a;
600              Evas_Object *o;
601
602              o = mi->o_icon;
603              exp_size_get(o_menu_logo, &w, &h);
604              len = ((w * 3) + 10) / 4;
605              exp_size_get(o, &w, &h);
606              x = (win_w / 2)
607                 + (sin((menu_anim - (double)i) * 0.33) * len)
608                 - (w / 2);
609              y = (win_h / 2)
610                 + (cos((menu_anim - (double)i) * 0.33) * len)
611                 - (h / 2);
612              efl_gfx_entity_position_set(o, EINA_POSITION2D(x, y));
613              a = menu_anim - (double)i;
614              if (a < 0) a = -a;
615              a = 255 - (30 * a);
616              if (a < 0) a = 0;
617              if (a > 255) a = 255;
618              efl_gfx_color_set(o, a, a, a, a);
619              efl_gfx_entity_visible_set(o, EINA_TRUE);
620
621              if (i == menu_sel)
622                {
623                   a = menu_anim - (double)i;
624                   if (a < 0) a = -a;
625                   a = 255 - (255 * a);
626                   if (a < 0) a = 0;
627                   if (a > 255) a = 255;
628
629                   o = o_menu_icon_sel;
630                   efl_gfx_entity_position_set(o, EINA_POSITION2D(x - ((48 - w) / 2), y - ((48 - h) / 2)));
631                   efl_gfx_color_set(o, a, a, a, a);
632
633                   o = o_menu_title;
634                   efl_gfx_color_set(o, a, a, a, a);
635                   efl_text_set(o, mi->text);
636                   exp_size_get(o, &tw, &th);
637                   x = (win_w - tw) / 2;
638                   y = (win_h / 2) + len + 48;
639                   efl_gfx_entity_position_set(o, EINA_POSITION2D(x, y));
640
641                   o = o_menu_text_sel;
642                   w = tw + 24;
643                   h = 28;
644                   x = x - 12;
645                   y = y + ((th - h) / 2);
646                   efl_gfx_entity_position_set(o, EINA_POSITION2D(x, y));
647                   efl_gfx_entity_size_set(o, EINA_SIZE2D(w, h));
648                   efl_gfx_fill_set(o, EINA_RECT(0, 0, w, h));
649                   efl_gfx_color_set(o, a, a, a, a);
650                }
651              i++;
652           }
653         efl_gfx_entity_position_set(o_menu_logo, EINA_POSITION2D((win_w - 120) / 2, ((win_h - 160) / 2)));
654         efl_gfx_entity_visible_set(o_menu_logo, EINA_TRUE);
655         _ui_menu_show(EINA_TRUE);
656      }
657    else
658      {
659      }
660
661    return EINA_TRUE;
662 }
663
664 void
665 ui_menu(void)
666 {
667    efl_gfx_entity_visible_set(o_title, EINA_TRUE);
668    efl_gfx_entity_visible_set(o_byline, EINA_TRUE);
669    efl_text_set
670          (o_byline, "LEFT/RIGHT - select, ENTER - select, ESCAPE - exit.");
671    menu_active = 1;
672    key_func = NULL;
673    loop_func = NULL;
674
675    ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
676 }
677
678 void
679 ui_func_set(void (*kfunc) (const char *key), void (*lfunc) (double t, int f), void (*lsetup) (void))
680 {
681    key_func = kfunc;
682    loop_func = lfunc;
683    t_loop = t_start = get_time();
684    f_loop = f_start = 0;
685    ui_fps(0.0);
686
687    lsetup();
688
689    if (tick)
690      {
691         ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
692         ecore_animator_custom_tick();
693      }
694 }
695
696 void
697 ui_all(void)
698 {
699    Eina_List *l;
700    Menu_Item *mi;
701    int i = 0;
702    double t, t0;
703
704    _ui_menu_show(EINA_FALSE);
705
706    /* warm up the cpu with some spinning */
707    t0 = time(NULL);
708    for (;;)
709      {
710         t = time(NULL);
711         if (t - t0 > 2) break;
712      }
713
714    wfps = 0;
715
716    EINA_LIST_FOREACH(menu, l, mi)
717      {
718         i++;
719
720         if (!mi->test)
721           continue;
722
723         menu_sel = i - 1;
724         test_item = menu_sel;
725         _ui_select();
726         break;
727      }
728 }
729
730 void
731 ui_fps(double fps)
732 {
733    p_fps += fps;
734    if (fps > 0.0 && test_item > 0)
735      {
736         Menu_Item *mi;
737
738         key_func("Escape");
739
740         /* This does not give time to delete the objects of the previous test
741            and make the result of next test less accurate. Benefit we do not
742            loose track of any of the cost anymore (Would be better to force
743            an empty render and account that to the previous test). */
744
745         wfps += (fps * weights[test_item]);
746
747         test_item++;
748         mi = eina_list_nth(menu, test_item);
749         if (one_test || !mi->test)
750           {
751              char datestr[1024];
752              struct tm *tim;
753              time_t now;
754              double avgw = 0.0;
755              unsigned int i;
756              unsigned int t_count;
757
758              t_count = EINA_C_ARRAY_LENGTH(weights) - 3;
759              for (i = 2; i < EINA_C_ARRAY_LENGTH(weights) - 1; i++)
760                avgw += weights[i];
761              avgw /= t_count;
762
763              now = time(NULL);
764              tim = localtime(&now);
765              if (tim) strftime(datestr, sizeof(datestr), "%Y-%m-%d %H:%M:%S", tim);
766              else snprintf(datestr, sizeof(datestr), "unknown");
767
768              if (cmp_report)
769                printf("%5.2f , EVAS SPEED (WEIGHTED), "
770                       "tn, %i , "
771                       "t, %s , "
772                       "ev , %i.%i.%i.%i , "
773                       "p , %s , "
774                       "sz , %i , %i , "
775                       "c , %i , "
776                       "e , %s , "
777                       "fs , %i\n",
778                       wfps / (t_count * avgw),
779                       // fps / t_count,
780                       t_count,
781                       datestr,
782                       evas_version->major,
783                       evas_version->minor,
784                       evas_version->micro,
785                       evas_version->revision,
786                       profile,
787                       win_w, win_h,
788                       loops,
789                       choosen_engine,
790                       fullscreen);
791              else
792                printf("\n#####Test Result#####\n"
793                       "evas fps speed: %5.2f\n"
794                       "evas fps speed(weighted): %5.2f\n"
795                       "testcase count: %i\n"
796                       "date: %s\n"
797                       "evas version: %i.%i.%i.%i\n"
798                       "profile: %s\n"
799                       "window size: %i, %i\n"
800                       "loop count: %i\n"
801                       "engine: %s\n"
802                       "full screen: %i\n",
803                       (p_fps / t_count),
804                       (wfps / avgw) / t_count,
805                       t_count,
806                       datestr,
807                       evas_version->major, evas_version->minor, evas_version->micro,
808                       evas_version->revision,
809                       profile,
810                       win_w, win_h,
811                       loops,
812                       choosen_engine,
813                       fullscreen);
814
815              ecore_main_loop_quit();
816           }
817         else
818           {
819              menu_sel = test_item;
820              _ui_select();
821           }
822      }
823 }