More profiler reshuffling

Add more of the marks without requiring a debug build.
This commit is contained in:
Matthias Clasen 2020-01-22 19:04:53 -05:00
parent 278762f00a
commit 3c03d7970a
3 changed files with 9 additions and 30 deletions

View File

@ -737,7 +737,6 @@ _gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock)
"frameclock ::resume-events", ""); "frameclock ::resume-events", "");
} }
#ifdef G_ENABLE_DEBUG
static gint64 static gint64
guess_refresh_interval (GdkFrameClock *frame_clock) 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); return ((double) end_counter - start_counter) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
} }
#endif
void void
_gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *clock, _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *clock,
GdkFrameTimings *timings) 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) if (timings->presentation_time != 0)
gdk_profiler_add_mark (timings->presentation_time * 1000, gdk_profiler_add_mark (timings->presentation_time * 1000,
0, 0,
"presentation", ""); "presentation", "");
gdk_profiler_set_counter (fps_counter, gdk_profiler_set_counter (fps_counter,
timings->frame_end_time * 1000, timings->presentation_time * 1000,
frame_clock_get_fps (clock)); frame_clock_get_fps (clock));
#endif
} }

View File

@ -42,9 +42,7 @@ struct _GdkFrameClockIdlePrivate
gint64 frame_time; gint64 frame_time;
gint64 min_next_frame_time; gint64 min_next_frame_time;
gint64 sleep_serial; gint64 sleep_serial;
#ifdef G_ENABLE_DEBUG
gint64 freeze_time; gint64 freeze_time;
#endif
guint flush_idle_id; guint flush_idle_id;
guint paint_idle_id; guint paint_idle_id;
@ -408,12 +406,14 @@ gdk_frame_clock_paint_idle (void *data)
if (priv->freeze_count == 0) if (priv->freeze_count == 0)
{ {
int iter; 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 && if (priv->phase != GDK_FRAME_CLOCK_PHASE_LAYOUT &&
(priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT)) (priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT))
timings->layout_start_time = g_get_monotonic_time (); timings->layout_start_time = g_get_monotonic_time ();
} }
#endif
priv->phase = GDK_FRAME_CLOCK_PHASE_LAYOUT; priv->phase = GDK_FRAME_CLOCK_PHASE_LAYOUT;
/* We loop in the layout phase, because we don't want to progress /* 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: case GDK_FRAME_CLOCK_PHASE_PAINT:
if (priv->freeze_count == 0) 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 && if (priv->phase != GDK_FRAME_CLOCK_PHASE_PAINT &&
(priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT)) (priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT))
timings->paint_start_time = g_get_monotonic_time (); timings->paint_start_time = g_get_monotonic_time ();
} }
#endif
priv->phase = GDK_FRAME_CLOCK_PHASE_PAINT; priv->phase = GDK_FRAME_CLOCK_PHASE_PAINT;
if (priv->requested & 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; priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
} }
#ifdef G_ENABLE_DEBUG #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 (); timings->frame_end_time = g_get_monotonic_time ();
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */
G_GNUC_FALLTHROUGH; G_GNUC_FALLTHROUGH;
@ -557,13 +559,11 @@ gdk_frame_clock_idle_freeze (GdkFrameClock *clock)
GdkFrameClockIdle *clock_idle = GDK_FRAME_CLOCK_IDLE (clock); GdkFrameClockIdle *clock_idle = GDK_FRAME_CLOCK_IDLE (clock);
GdkFrameClockIdlePrivate *priv = clock_idle->priv; GdkFrameClockIdlePrivate *priv = clock_idle->priv;
#ifdef G_ENABLE_DEBUG
if (priv->freeze_count == 0) if (priv->freeze_count == 0)
{ {
if (gdk_profiler_is_running ()) if (gdk_profiler_is_running ())
priv->freeze_time = g_get_monotonic_time (); priv->freeze_time = g_get_monotonic_time ();
} }
#endif
priv->freeze_count++; priv->freeze_count++;
maybe_stop_idle (clock_idle); maybe_stop_idle (clock_idle);
@ -590,7 +590,6 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
priv->sleep_serial = get_sleep_serial (); priv->sleep_serial = get_sleep_serial ();
#ifdef G_ENABLE_DEBUG
if (gdk_profiler_is_running ()) if (gdk_profiler_is_running ())
{ {
if (priv->freeze_time != 0) if (priv->freeze_time != 0)
@ -602,7 +601,6 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
priv->freeze_time = 0; priv->freeze_time = 0;
} }
} }
#endif
} }
} }

View File

@ -396,10 +396,10 @@ frame_callback (void *data,
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0) if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
_gdk_frame_clock_debug_print_timings (clock, timings); _gdk_frame_clock_debug_print_timings (clock, timings);
#endif
if (gdk_profiler_is_running ()) if (gdk_profiler_is_running ())
_gdk_frame_clock_add_timings_to_profiler (clock, timings); _gdk_frame_clock_add_timings_to_profiler (clock, timings);
#endif
} }
static const struct wl_callback_listener frame_listener = { static const struct wl_callback_listener frame_listener = {