[gtk/matthiasc/for-master: 1/8] More profiler reshuffling



commit 3c03d7970a65ea7e1cafbe147a24e71233b749ff
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 22 19:04:53 2020 -0500

    More profiler reshuffling
    
    Add more of the marks without requiring a debug build.

 gdk/gdkframeclock.c              | 21 +--------------------
 gdk/gdkframeclockidle.c          | 16 +++++++---------
 gdk/wayland/gdksurface-wayland.c |  2 +-
 3 files changed, 9 insertions(+), 30 deletions(-)
---
diff --git a/gdk/gdkframeclock.c b/gdk/gdkframeclock.c
index 9626a9f3d2..db16c7653e 100644
--- a/gdk/gdkframeclock.c
+++ b/gdk/gdkframeclock.c
@@ -737,7 +737,6 @@ _gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock)
                            "frameclock ::resume-events", "");
 }
 
-#ifdef G_ENABLE_DEBUG
 static gint64
 guess_refresh_interval (GdkFrameClock *frame_clock)
 {
@@ -807,35 +806,17 @@ frame_clock_get_fps (GdkFrameClock *frame_clock)
     
   return ((double) end_counter - start_counter) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
 }
-#endif
 
 void
 _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock   *clock,
                                           GdkFrameTimings *timings)
 {
-#ifdef G_ENABLE_DEBUG
-#if 0
-  gdk_profiler_add_mark (timings->frame_time * 1000,
-                         (timings->frame_end_time - timings->frame_time) * 1000,
-                         "frame", "");
-
-  if (timings->layout_start_time != 0)
-    gdk_profiler_add_mark (timings->layout_start_time * 1000,
-                           (timings->paint_start_time - timings->layout_start_time) * 1000,
-                            "layout", "");
-
-  if (timings->paint_start_time != 0)
-    gdk_profiler_add_mark (timings->paint_start_time * 1000,
-                           (timings->frame_end_time - timings->paint_start_time) * 1000,
-                            "paint", "");
-#endif
   if (timings->presentation_time != 0)
     gdk_profiler_add_mark (timings->presentation_time * 1000,
                            0,
                            "presentation", "");
 
   gdk_profiler_set_counter (fps_counter,
-                            timings->frame_end_time * 1000,
+                            timings->presentation_time * 1000,
                             frame_clock_get_fps (clock)); 
-#endif
 }
diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c
index f5af719cc1..1d11ae4fe7 100644
--- a/gdk/gdkframeclockidle.c
+++ b/gdk/gdkframeclockidle.c
@@ -42,9 +42,7 @@ struct _GdkFrameClockIdlePrivate
   gint64 frame_time;
   gint64 min_next_frame_time;
   gint64 sleep_serial;
-#ifdef G_ENABLE_DEBUG
   gint64 freeze_time;
-#endif
 
   guint flush_idle_id;
   guint paint_idle_id;
@@ -408,12 +406,14 @@ gdk_frame_clock_paint_idle (void *data)
           if (priv->freeze_count == 0)
             {
              int iter;
-              if (GDK_DEBUG_CHECK (FRAMES) || gdk_profiler_is_running ())
+#ifdef G_ENABLE_DEBUG
+              if (GDK_DEBUG_CHECK (FRAMES))
                 {
                   if (priv->phase != GDK_FRAME_CLOCK_PHASE_LAYOUT &&
                       (priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT))
                     timings->layout_start_time = g_get_monotonic_time ();
                 }
+#endif
 
               priv->phase = GDK_FRAME_CLOCK_PHASE_LAYOUT;
              /* We loop in the layout phase, because we don't want to progress
@@ -436,12 +436,14 @@ gdk_frame_clock_paint_idle (void *data)
         case GDK_FRAME_CLOCK_PHASE_PAINT:
           if (priv->freeze_count == 0)
             {
-              if (GDK_DEBUG_CHECK (FRAMES) || gdk_profiler_is_running ())
+#ifdef G_ENABLE_DEBUG
+              if (GDK_DEBUG_CHECK (FRAMES))
                 {
                   if (priv->phase != GDK_FRAME_CLOCK_PHASE_PAINT &&
                       (priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT))
                     timings->paint_start_time = g_get_monotonic_time ();
                 }
+#endif
 
               priv->phase = GDK_FRAME_CLOCK_PHASE_PAINT;
               if (priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT)
@@ -462,7 +464,7 @@ gdk_frame_clock_paint_idle (void *data)
               priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
             }
 #ifdef G_ENABLE_DEBUG
-            if (GDK_DEBUG_CHECK (FRAMES) || gdk_profiler_is_running ())
+            if (GDK_DEBUG_CHECK (FRAMES))
               timings->frame_end_time = g_get_monotonic_time ();
 #endif /* G_ENABLE_DEBUG */
           G_GNUC_FALLTHROUGH;
@@ -557,13 +559,11 @@ gdk_frame_clock_idle_freeze (GdkFrameClock *clock)
   GdkFrameClockIdle *clock_idle = GDK_FRAME_CLOCK_IDLE (clock);
   GdkFrameClockIdlePrivate *priv = clock_idle->priv;
 
-#ifdef G_ENABLE_DEBUG
   if (priv->freeze_count == 0)
     {
       if (gdk_profiler_is_running ())
         priv->freeze_time = g_get_monotonic_time ();
     }
-#endif
 
   priv->freeze_count++;
   maybe_stop_idle (clock_idle);
@@ -590,7 +590,6 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
 
       priv->sleep_serial = get_sleep_serial ();
 
-#ifdef G_ENABLE_DEBUG
       if (gdk_profiler_is_running ())
         {
           if (priv->freeze_time != 0)
@@ -602,7 +601,6 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
               priv->freeze_time = 0;
             }
         }
-#endif
     }
 }
 
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index ac42a28145..4850bafd8a 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -396,10 +396,10 @@ frame_callback (void               *data,
 #ifdef G_ENABLE_DEBUG
   if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
     _gdk_frame_clock_debug_print_timings (clock, timings);
+#endif
 
   if (gdk_profiler_is_running ())
     _gdk_frame_clock_add_timings_to_profiler (clock, timings);
-#endif
 }
 
 static const struct wl_callback_listener frame_listener = {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]