[gtk] widget: Add profiler marks
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] widget: Add profiler marks
- Date: Wed, 22 Jan 2020 04:45:16 +0000 (UTC)
commit 5014b2a7fe0f34c1c862d970cbc8627e3a384cdc
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jan 21 23:43:37 2020 -0500
widget: Add profiler marks
This gives high-level entries for the duration of
snapshotting and layout in the frame cycle.
gtk/gtkwidget.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index fb3cbec94a..2aedd1f727 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -77,6 +77,7 @@
#include "inspector/window.h"
#include "gdk/gdkeventsprivate.h"
+#include "gdk/gdkprofilerprivate.h"
#include "gsk/gskdebugprivate.h"
#include "gsk/gskrendererprivate.h"
@@ -12290,6 +12291,8 @@ gtk_widget_render (GtkWidget *widget,
GskRenderer *renderer;
GskRenderNode *root;
int x, y;
+ gint64 before = g_get_monotonic_time ();
+ gint64 after = 0;
if (!GTK_IS_NATIVE (widget))
return;
@@ -12304,6 +12307,12 @@ gtk_widget_render (GtkWidget *widget,
gtk_widget_snapshot (widget, snapshot);
root = gtk_snapshot_free_to_node (snapshot);
+ if (gdk_profiler_is_running ())
+ {
+ after = g_get_monotonic_time ();
+ gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "snapshot", "");
+ }
+
if (root != NULL)
{
root = gtk_inspector_prepare_render (widget,
@@ -12315,6 +12324,13 @@ gtk_widget_render (GtkWidget *widget,
gsk_renderer_render (renderer, root, region);
gsk_render_node_unref (root);
+
+ if (gdk_profiler_is_running ())
+ {
+ before = after;
+ after = g_get_monotonic_time ();
+ gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "render", "");
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]