[gtk/matthiasc/for-master-2: 11/16] frameclock: cosmetics



commit a1f4fbde3202141750ceb11c207b8108acc8f047
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Feb 4 23:07:43 2020 +0100

    frameclock: cosmetics
    
    Redo the profiler marks for the frame clock signals
    to look more uniform.

 gdk/gdkframeclock.c | 78 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 41 insertions(+), 37 deletions(-)
---
diff --git a/gdk/gdkframeclock.c b/gdk/gdkframeclock.c
index db16c7653e..272edbe4f6 100644
--- a/gdk/gdkframeclock.c
+++ b/gdk/gdkframeclock.c
@@ -261,10 +261,8 @@ gdk_frame_clock_init (GdkFrameClock *clock)
   priv->frame_counter = -1;
   priv->current = FRAME_HISTORY_MAX_LENGTH - 1;
 
-#ifdef G_ENABLE_DEBUG
   if (fps_counter == 0)
     fps_counter = gdk_profiler_define_counter ("fps", "Frames per Second");
-#endif
 }
 
 /**
@@ -649,92 +647,99 @@ gdk_frame_clock_get_refresh_info (GdkFrameClock *frame_clock,
 void
 _gdk_frame_clock_emit_flush_events (GdkFrameClock *frame_clock)
 {
-  guint64 before = g_get_monotonic_time ();
+  gint64 before = g_get_monotonic_time ();
 
   g_signal_emit (frame_clock, signals[FLUSH_EVENTS], 0);
 
   if (gdk_profiler_is_running ())
-    gdk_profiler_add_mark (before * 1000,
-                           (g_get_monotonic_time () - before) * 1000,
-                           "frameclock ::flush-events", "");
+    {
+      gint64 after = g_get_monotonic_time ();
+      gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "flush-events");
+    }
 }
 
 void
 _gdk_frame_clock_emit_before_paint (GdkFrameClock *frame_clock)
 {
-  guint64 before = g_get_monotonic_time ();
+  gint64 before = g_get_monotonic_time ();
 
   g_signal_emit (frame_clock, signals[BEFORE_PAINT], 0);
 
   if (gdk_profiler_is_running ())
-    gdk_profiler_add_mark (before * 1000,
-                           (g_get_monotonic_time () - before) * 1000,
-                           "frameclock ::before-paint", "");
+    {
+      gint64 after = g_get_monotonic_time ();
+      gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "before-paint");
+    }
 }
 
 void
 _gdk_frame_clock_emit_update (GdkFrameClock *frame_clock)
 {
-  guint64 before = g_get_monotonic_time ();
+  gint64 before = g_get_monotonic_time ();
 
   g_signal_emit (frame_clock, signals[UPDATE], 0);
 
   if (gdk_profiler_is_running ())
-    gdk_profiler_add_mark (before * 1000,
-                           (g_get_monotonic_time () - before) * 1000,
-                           "frameclock ::update", "");
+    {
+      gint64 after = g_get_monotonic_time ();
+      gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "update");
+    }
 }
 
 void
 _gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock)
 {
-  guint64 before = g_get_monotonic_time ();
+  gint64 before = g_get_monotonic_time ();
 
   g_signal_emit (frame_clock, signals[LAYOUT], 0);
 
   if (gdk_profiler_is_running ())
-    gdk_profiler_add_mark (before * 1000,
-                           (g_get_monotonic_time () - before) * 1000,
-                           "frameclock ::layout", "");
+    {
+      gint64 after = g_get_monotonic_time ();
+      gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "layout");
+    }
 }
 
 void
 _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
 {
-  guint64 before = g_get_monotonic_time ();
+  gint64 before = g_get_monotonic_time ();
 
   g_signal_emit (frame_clock, signals[PAINT], 0);
 
   if (gdk_profiler_is_running ())
-    gdk_profiler_add_mark (before * 1000,
-                           (g_get_monotonic_time () - before) * 1000,
-                           "frameclock ::paint", "");
+    {
+      gint64 after = g_get_monotonic_time ();
+      gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "paint");
+    }
 }
 
 void
 _gdk_frame_clock_emit_after_paint (GdkFrameClock *frame_clock)
 {
-  guint64 before = g_get_monotonic_time ();
+  gint64 before = g_get_monotonic_time ();
 
   g_signal_emit (frame_clock, signals[AFTER_PAINT], 0);
 
   if (gdk_profiler_is_running ())
-    gdk_profiler_add_mark (before * 1000,
-                           (g_get_monotonic_time () - before) * 1000,
-                           "frameclock ::after-paint", "");
+    {
+      gint64 after = g_get_monotonic_time ();
+      gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "after-paint");
+    }
 }
 
 void
 _gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock)
 {
-  guint64 before = g_get_monotonic_time ();
+  gint64 before = g_get_monotonic_time ();
 
   g_signal_emit (frame_clock, signals[RESUME_EVENTS], 0);
 
   if (gdk_profiler_is_running ())
-    gdk_profiler_add_mark (before * 1000,
-                           (g_get_monotonic_time () - before) * 1000,
-                           "frameclock ::resume-events", "");
+    {
+      gint64 after = g_get_monotonic_time ();
+      gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "resume-events");
+    }
 }
 
 static gint64
@@ -812,11 +817,10 @@ _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock   *clock,
                                           GdkFrameTimings *timings)
 {
   if (timings->presentation_time != 0)
-    gdk_profiler_add_mark (timings->presentation_time * 1000,
-                           0,
-                           "presentation", "");
-
-  gdk_profiler_set_counter (fps_counter,
-                            timings->presentation_time * 1000,
-                            frame_clock_get_fps (clock)); 
+    {
+      gdk_profiler_add_mark (timings->presentation_time * 1000, 0, "frameclock", "presentation");
+      gdk_profiler_set_counter (fps_counter,
+                                timings->presentation_time * 1000,
+                                frame_clock_get_fps (clock)); 
+    }
 }


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