[mutter] clutter/frame-clock: Add presented profile trace
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/frame-clock: Add presented profile trace
- Date: Fri, 4 Mar 2022 07:49:07 +0000 (UTC)
commit e10084199bbd836de8850efa648bfad390e139a3
Author: Ivan Molodetskikh <yalterz gmail com>
Date: Tue Dec 14 12:32:42 2021 +0300
clutter/frame-clock: Add presented profile trace
In addition to the presented callback time, it shows the time to the
reported presentation time (which can be earlier or later than the
presented callback), as well as the GPU rendering duration.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1928>
clutter/clutter/clutter-frame-clock.c | 42 +++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
---
diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c
index 164e77c083..17bd900370 100644
--- a/clutter/clutter/clutter-frame-clock.c
+++ b/clutter/clutter/clutter-frame-clock.c
@@ -228,6 +228,48 @@ void
clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
ClutterFrameInfo *frame_info)
{
+ COGL_TRACE_BEGIN_SCOPED (ClutterFrameClockNotifyPresented,
+ "Frame Clock (presented)");
+
+#ifdef COGL_HAS_TRACING
+ if (G_UNLIKELY (cogl_is_tracing_enabled ()))
+ {
+ int64_t current_time_us;
+ g_autoptr (GString) description = NULL;
+
+ current_time_us = g_get_monotonic_time ();
+ description = g_string_new (NULL);
+
+ if (frame_info->presentation_time != 0)
+ {
+ if (frame_info->presentation_time <= current_time_us)
+ {
+ g_string_append_printf (description,
+ "presentation was %ld µs earlier",
+ current_time_us - frame_info->presentation_time);
+ }
+ else
+ {
+ g_string_append_printf (description,
+ "presentation will be %ld µs later",
+ frame_info->presentation_time - current_time_us);
+ }
+ }
+
+ if (frame_info->gpu_rendering_duration_ns != 0)
+ {
+ if (description->len > 0)
+ g_string_append (description, ", ");
+
+ g_string_append_printf (description,
+ "buffer swap to GPU done: %ld µs",
+ ns2us (frame_info->gpu_rendering_duration_ns));
+ }
+
+ COGL_TRACE_DESCRIBE (ClutterFrameClockNotifyPresented, description->str);
+ }
+#endif
+
frame_clock->last_presentation_time_us = frame_info->presentation_time;
frame_clock->got_measurements_last_frame = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]