On Thu, Jan 17, 2013 at 11:31 PM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
> evas_render: Measure time spent while rendering in sync  and async modes

You should use an eina_counter it would be more precise and later we
could bench it on other OS to.

> Author:       acidx
> Date:         2013-01-17 06:31:34 -0800 (Thu, 17 Jan 2013)
> New Revision: 82936
> Trac:         http://trac.enlightenment.org/e/changeset/82936
>
> Modified:
>   trunk/efl/src/lib/evas/canvas/evas_render.c 
> trunk/efl/src/modules/ecore_evas/engines/x/ecore_evas_x.c
>
> Modified: trunk/efl/src/lib/evas/canvas/evas_render.c
> ===================================================================
> --- trunk/efl/src/lib/evas/canvas/evas_render.c 2013-01-17 13:49:14 UTC (rev 
> 82935)
> +++ trunk/efl/src/lib/evas/canvas/evas_render.c 2013-01-17 14:31:34 UTC (rev 
> 82936)
> @@ -5,6 +5,10 @@
>  #include "evas_cs2_private.h"
>  #endif
>
> +#ifdef EVAS_RENDER_DEBUG_TIMING
> +#include <sys/time.h>
> +#endif
> +
>  /* debug rendering
>   * NOTE: Define REND_DBG 1 in evas_private.h to enable debugging. Don't 
> define
>   * it here since the flag is used on other places too. */
> @@ -59,6 +63,59 @@
>  static Eina_Bool
>  evas_render_updates_internal(Evas *eo_e, unsigned char make_updates, 
> unsigned char do_draw, Evas_Render_Done_Cb done_func, void *done_data, 
> Evas_Event_Cb updates_func, void *updates_data, Eina_Bool do_async);
>
> +#ifdef EVAS_RENDER_DEBUG_TIMING
> +static double
> +_time_get()
> +{
> +   struct timeval tv;
> +
> +   gettimeofday(&tv, NULL);
> +
> +   return (tv.tv_sec + tv.tv_usec / 1000000.0) * 1000.0;
> +}
> +
> +struct accumulator {
> +   double total, min, max;
> +   int samples;
> +   const char *what;
> +};
> +
> +static struct accumulator async_accumulator = {
> +   .total = 0,
> +   .min = 1000000,
> +   .max = 0,
> +   .samples = 0,
> +   .what = "async render"
> +};
> +static struct accumulator sync_accumulator = {
> +   .total = 0,
> +   .min = 1000000,
> +   .max = 0,
> +   .samples = 0,
> +   .what = "sync render"
> +};
> +
> +static void
> +_accumulate_time(double before, struct accumulator *acc)
> +{
> +   double diff = _time_get() - before;
> +
> +   acc->total += diff;
> +   if (diff > acc->max) acc->max = diff;
> +   if (diff < acc->min) acc->min = diff;
> +
> +   acc->samples++;
> +   if (acc->samples % 100 == 0)
> +     {
> +        fprintf(stderr, "*** %s: avg %fms min %fms max %fms\n",
> +                acc->what, acc->total / 100.0, acc->min, acc->max);
> +        acc->total = 0.0;
> +        acc->max = 0.0;
> +        acc->min = 1000000;
> +     }
> +}
> +#endif
> +
>  EAPI void
>  evas_damage_rectangle_add(Evas *eo_e, int x, int y, int w, int h)
>  {
> @@ -1361,6 +1418,9 @@
>     int redraw_all = 0;
>     Eina_Bool haveup = 0;
>     Evas_Render_Mode render_mode = EVAS_RENDER_MODE_UNDEF;
> +#ifdef EVAS_RENDER_DEBUG_TIMING
> +   double start_time = _time_get();
> +#endif
>
>     MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
>     return EINA_FALSE;
> @@ -1852,6 +1912,10 @@
>
>     RD("---]\n");
>
> +#ifdef EVAS_RENDER_DEBUG_TIMING
> +   _accumulate_time(start_time, do_async ? &async_accumulator : 
> &sync_accumulator);
> +#endif
> +
>     return EINA_TRUE;
>  }
>
>
> Modified: trunk/efl/src/modules/ecore_evas/engines/x/ecore_evas_x.c
> ===================================================================
> --- trunk/efl/src/modules/ecore_evas/engines/x/ecore_evas_x.c   2013-01-17 
> 13:49:14 UTC (rev 82935)
> +++ trunk/efl/src/modules/ecore_evas/engines/x/ecore_evas_x.c   2013-01-17 
> 14:31:34 UTC (rev 82936)
> @@ -3178,8 +3178,12 @@
>     ee->prop.request_pos = 0;
>     ee->prop.sticky = 0;
>     edata->state.sticky = 0;
> -   ee->can_async_render = 1;
>
> +   if (getenv("ECORE_EVAS_FORCE_SYNC_RENDER"))
> +     ee->can_async_render = 0;
> +   else
> +     ee->can_async_render = 1;
> +
>     /* init evas here */
>     ee->evas = evas_new();
>     evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE,
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>



--
Cedric BAIL

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to