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