frameclock: cosmetics

Redo the profiler marks for the frame clock signals
to look more uniform.
This commit is contained in:
Matthias Clasen 2020-02-04 23:07:43 +01:00
parent 9e6ae7acd8
commit 9a446f2041

View File

@ -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));
}
}