Commit a10b1b73 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Add more sysprof marks

Add a few more marks during gtk_init to figure out where
our startup time goes, and avoid the sysprof initialization
from distorting the first mark.
parent 02c62267
Pipeline #299594 passed with stages
in 11 minutes and 51 seconds
......@@ -1200,6 +1200,10 @@ gdk_display_init_gl (GdkDisplay *self)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
GdkGLContext *context;
gint64 before G_GNUC_UNUSED;
gint64 before2 G_GNUC_UNUSED;
before = GDK_PROFILER_CURRENT_TIME;
if (GDK_DISPLAY_DEBUG_CHECK (self, GL_DISABLE))
{
......@@ -1213,17 +1217,23 @@ gdk_display_init_gl (GdkDisplay *self)
if (context == NULL)
return;
before2 = GDK_PROFILER_CURRENT_TIME;
if (!gdk_gl_context_realize (context, &priv->gl_error))
{
g_object_unref (context);
return;
}
gdk_profiler_end_mark (before2, "realize OpenGL context", NULL);
/* Only assign after realize, so GdkGLContext::realize() can use
* gdk_display_get_gl_context() == NULL to differentiate between
* the display's context and any other context.
*/
priv->gl_context = context;
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
}
/**
......@@ -1268,6 +1278,8 @@ gdk_display_prepare_gl (GdkDisplay *self,
{
if (error)
*error = g_error_copy (priv->gl_error);
return FALSE;
}
......
......@@ -26,6 +26,7 @@
#include <gdk/gdkglcontextprivate.h>
#include <gdk/gdkdisplayprivate.h>
#include <gdk/gdktextureprivate.h>
#include <gdk/gdkprofilerprivate.h>
#include <gsk/gskdebugprivate.h>
#include <gsk/gskglshaderprivate.h>
#include <gsk/gskrendererprivate.h>
......@@ -329,6 +330,7 @@ gsk_ngl_driver_load_programs (GskNglDriver *self,
{
GskNglCompiler *compiler;
gboolean ret = FALSE;
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
g_assert (GSK_IS_NGL_DRIVER (self));
g_assert (GSK_IS_NGL_COMMAND_QUEUE (self->command_queue));
......@@ -396,6 +398,8 @@ gsk_ngl_driver_load_programs (GskNglDriver *self,
failure:
g_clear_object (&compiler);
gdk_profiler_end_mark (start_time, "load programs", NULL);
return ret;
}
......@@ -422,9 +426,12 @@ gsk_ngl_driver_new (GskNglCommandQueue *command_queue,
{
GskNglDriver *self;
GdkGLContext *context;
gint64 before G_GNUC_UNUSED;
g_return_val_if_fail (GSK_IS_NGL_COMMAND_QUEUE (command_queue), NULL);
before = GDK_PROFILER_CURRENT_TIME;
context = gsk_ngl_command_queue_get_context (command_queue);
gdk_gl_context_make_current (context);
......@@ -444,6 +451,8 @@ gsk_ngl_driver_new (GskNglCommandQueue *command_queue,
self->icons = gsk_ngl_icon_library_new (self);
self->shadows = gsk_ngl_shadow_library_new (self);
gdk_profiler_end_mark (before, "create GskNglDriver", NULL);
return g_steal_pointer (&self);
}
......
......@@ -125,7 +125,7 @@ failure:
g_clear_object (&driver);
g_clear_object (&context);
gdk_profiler_end_mark (start_time, "GskNglRenderer realize", NULL);
gdk_profiler_end_mark (start_time, "realize GskNglRenderer", NULL);
return ret;
}
......
......@@ -26,6 +26,7 @@
#include "gdk/gdk.h"
#include "gdk/gdk-private.h"
#include "gdk/gdkprofilerprivate.h"
#include "gsk/gskprivate.h"
#include "gsk/gskrendernodeprivate.h"
#include "gtknative.h"
......@@ -520,10 +521,13 @@ static void
do_post_parse_initialization (void)
{
GdkDisplayManager *display_manager;
gint64 before G_GNUC_UNUSED;
if (gtk_initialized)
return;
before = GDK_PROFILER_CURRENT_TIME;
gettext_initialization ();
#ifdef SIGPIPE
......@@ -533,21 +537,28 @@ do_post_parse_initialization (void)
gtk_widget_set_default_direction (gtk_get_locale_direction ());
gdk_event_init_types ();
gsk_ensure_resources ();
gsk_render_node_init_types ();
_gtk_ensure_resources ();
gdk_profiler_end_mark (before, "basic initialization", NULL);
gtk_initialized = TRUE;
before = GDK_PROFILER_CURRENT_TIME;
#ifdef G_OS_UNIX
gtk_print_backends_init ();
#endif
gtk_im_modules_init ();
gtk_media_file_extension_init ();
gdk_profiler_end_mark (before, "init modules", NULL);
before = GDK_PROFILER_CURRENT_TIME;
display_manager = gdk_display_manager_get ();
if (gdk_display_manager_get_default_display (display_manager) != NULL)
default_display_notify_cb (display_manager);
gdk_profiler_end_mark (before, "create display", NULL);
g_signal_connect (display_manager, "notify::default-display",
G_CALLBACK (default_display_notify_cb),
......@@ -580,6 +591,9 @@ gtk_init_check (void)
if (gtk_initialized)
return TRUE;
if (gdk_profiler_is_running ())
g_info ("Profiling is active");
gettext_initialization ();
if (!check_setugid ())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment