Tweak profiling strings

Capitalize our mark names, and use GTK as category.

The justification is: it looks better in sysprof.
This commit is contained in:
Matthias Clasen 2024-01-21 13:58:09 -05:00
parent a482cb5d25
commit f779832861
28 changed files with 56 additions and 58 deletions

View File

@ -1363,7 +1363,7 @@ gdk_display_init_gl (GdkDisplay *self)
return;
}
gdk_profiler_end_mark (before2, "realize OpenGL context", NULL);
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
@ -1373,7 +1373,7 @@ gdk_display_init_gl (GdkDisplay *self)
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
gdk_profiler_end_mark (before, "Init OpenGL", NULL);
}
/**
@ -1768,7 +1768,6 @@ gdk_display_init_egl (GdkDisplay *self,
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
G_GNUC_UNUSED gint64 start_time2;
int major, minor;
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
@ -1795,7 +1794,6 @@ gdk_display_init_egl (GdkDisplay *self,
return FALSE;
}
start_time2 = GDK_PROFILER_CURRENT_TIME;
if (!eglInitialize (priv->egl_display, &major, &minor))
{
priv->egl_display = NULL;
@ -1804,7 +1802,6 @@ gdk_display_init_egl (GdkDisplay *self,
_("Could not initialize EGL display"));
return FALSE;
}
gdk_profiler_end_mark (start_time2, "eglInitialize", NULL);
if (major < GDK_EGL_MIN_VERSION_MAJOR ||
(major == GDK_EGL_MIN_VERSION_MAJOR && minor < GDK_EGL_MIN_VERSION_MINOR))
@ -1894,7 +1891,7 @@ gdk_display_init_egl (GdkDisplay *self,
g_free (ext);
}
gdk_profiler_end_mark (start_time, "init EGL", NULL);
gdk_profiler_end_mark (start_time, "Init EGL", NULL);
return TRUE;
}

View File

@ -79,7 +79,7 @@ static guint signals[LAST_SIGNAL];
static guint fps_counter;
#define FRAME_HISTORY_MAX_LENGTH 128
#define FRAME_HISTORY_MAX_LENGTH 1000
struct _GdkFrameClockPrivate
{
@ -687,7 +687,7 @@ _gdk_frame_clock_emit_update (GdkFrameClock *frame_clock)
g_signal_emit (frame_clock, signals[UPDATE], 0);
gdk_profiler_end_mark (before, "frameclock update", NULL);
gdk_profiler_end_mark (before, "Frameclock update", NULL);
}
void
@ -699,7 +699,7 @@ _gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock)
g_signal_emit (frame_clock, signals[LAYOUT], 0);
gdk_profiler_end_mark (before, "frameclock layout", NULL);
gdk_profiler_end_mark (before, "Frameclock layout", NULL);
}
void
@ -711,7 +711,7 @@ _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
g_signal_emit (frame_clock, signals[PAINT], 0);
gdk_profiler_end_mark (before, "frameclock paint", NULL);
gdk_profiler_end_mark (before, "Frameclock paint", NULL);
}
void
@ -811,12 +811,12 @@ _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *clock,
{
if (timings->drawn_time != 0)
{
gdk_profiler_add_mark (1000 * timings->drawn_time, 0, "drawn window", NULL);
gdk_profiler_add_mark (1000 * timings->drawn_time, 0, "Drawn window", NULL);
}
if (timings->presentation_time != 0)
{
gdk_profiler_add_mark (1000 * timings->presentation_time, 0, "presented window", NULL);
gdk_profiler_add_mark (1000 * timings->presentation_time, 0, "Presented window", NULL);
}
gdk_profiler_set_counter (fps_counter, gdk_frame_clock_get_fps (clock));

View File

@ -694,7 +694,7 @@ gdk_frame_clock_paint_idle (void *data)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
priv->sleep_serial = get_sleep_serial ();
gdk_profiler_end_mark (before, "frameclock cycle", NULL);
gdk_profiler_end_mark (before, "Frameclock cycle", NULL);
return FALSE;
}

View File

@ -386,7 +386,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
else if (epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage"))
priv->eglSwapBuffersWithDamage = (gpointer) epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageEXT");
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
gdk_profiler_end_mark (start_time, "Create EGL context", NULL);
return api;
}
@ -669,7 +669,7 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
egl_surface = gdk_surface_get_egl_surface (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "EGL", "swap buffers");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "EGL swap buffers", NULL);
if (priv->eglSwapBuffersWithDamage)
{

View File

@ -32,6 +32,7 @@
#include "version/gdkversionmacros.h"
#include "gdkframeclockprivate.h"
#define CATEGORY "GTK"
gboolean
gdk_profiler_is_running (void)
@ -50,7 +51,7 @@ void
const char *message)
{
#ifdef HAVE_SYSPROF
sysprof_collector_mark (begin_time, duration, "gtk", name, message);
sysprof_collector_mark (begin_time, duration, CATEGORY, name, message);
#endif
}
@ -60,7 +61,7 @@ void
const char *message)
{
#ifdef HAVE_SYSPROF
sysprof_collector_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "gtk", name, message);
sysprof_collector_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, CATEGORY, name, message);
#endif
}
@ -74,7 +75,7 @@ void
#ifdef HAVE_SYSPROF
va_list args;
va_start (args, message_format);
sysprof_collector_mark_vprintf (begin_time, duration, "gtk", name, message_format, args);
sysprof_collector_mark_vprintf (begin_time, duration, CATEGORY, name, message_format, args);
va_end (args);
#endif /* HAVE_SYSPROF */
}
@ -88,7 +89,7 @@ void
#ifdef HAVE_SYSPROF
va_list args;
va_start (args, message_format);
sysprof_collector_mark_vprintf (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "gtk", name, message_format, args);
sysprof_collector_mark_vprintf (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, CATEGORY, name, message_format, args);
va_end (args);
#endif /* HAVE_SYSPROF */
}
@ -103,7 +104,7 @@ guint
counter.id = sysprof_collector_request_counters (1);
counter.type = SYSPROF_CAPTURE_COUNTER_DOUBLE;
counter.value.vdbl = 0.0;
g_strlcpy (counter.category, "gtk", sizeof counter.category);
g_strlcpy (counter.category, CATEGORY, sizeof counter.category);
g_strlcpy (counter.name, name, sizeof counter.name);
g_strlcpy (counter.description, description, sizeof counter.name);
@ -125,7 +126,7 @@ guint
counter.id = sysprof_collector_request_counters (1);
counter.type = SYSPROF_CAPTURE_COUNTER_INT64;
counter.value.v64 = 0;
g_strlcpy (counter.category, "gtk", sizeof counter.category);
g_strlcpy (counter.category, CATEGORY, sizeof counter.category);
g_strlcpy (counter.name, name, sizeof counter.name);
g_strlcpy (counter.description, description, sizeof counter.name);

View File

@ -2839,7 +2839,7 @@ add_event_mark (GdkEvent *event,
class = g_type_class_ref (GDK_TYPE_EVENT_TYPE);
value = g_enum_get_value (class, event_type);
g_type_class_unref (class);
kind = value ? value->value_nick : "event";
kind = value ? value->value_nick : "Event";
switch ((int) event_type)
{
@ -2909,7 +2909,7 @@ add_event_mark (GdkEvent *event,
break;
}
gdk_profiler_add_mark (time, end_time - time, "event", message ? message : kind);
gdk_profiler_add_mark (time, end_time - time, "Event", message ? message : kind);
g_free (message);
#endif

View File

@ -237,7 +237,7 @@ gdk_load_jpeg (GBytes *input_bytes,
g_bytes_unref (bytes);
gdk_profiler_end_mark (before, "jpeg load", NULL);
gdk_profiler_end_mark (before, "Load jpeg", NULL);
return texture;
}

View File

@ -304,7 +304,7 @@ gdk_load_png (GBytes *bytes,
{
gint64 end = GDK_PROFILER_CURRENT_TIME;
if (end - before > 500000)
gdk_profiler_add_mark (before, end - before, "png load", NULL);
gdk_profiler_add_mark (before, end - before, "Load png", NULL);
}
return texture;

View File

@ -504,7 +504,7 @@ gdk_load_tiff (GBytes *input_bytes,
{
gint64 end = GDK_PROFILER_CURRENT_TIME;
if (end - before > 500000)
gdk_profiler_add_mark (before, end - before, "tiff load", NULL);
gdk_profiler_add_mark (before, end - before, "Load tiff", NULL);
}
return texture;

View File

@ -186,7 +186,7 @@ gdk_wayland_cairo_context_end_frame (GdkDrawContext *draw_context,
gdk_wayland_surface_attach_image (surface, self->paint_surface, painted);
gdk_wayland_surface_request_frame (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
gdk_wayland_surface_commit (surface);
gdk_wayland_surface_notify_committed (surface);
@ -206,7 +206,7 @@ gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
gdk_wayland_surface_commit (surface);
gdk_wayland_surface_notify_committed (surface);
}

View File

@ -1253,7 +1253,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
g_value_unset (&v);
gdk_profiler_end_mark (before, "wayland", "load cursor theme");
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
}

View File

@ -1012,7 +1012,7 @@ gdk_wayland_surface_create_xdg_popup (GdkWaylandPopup *wayland_popup,
}
}
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
wl_surface_commit (impl->display_server.wl_surface);
if (GDK_IS_POPUP (surface))

View File

@ -274,7 +274,7 @@ gdk_wayland_surface_frame_callback (GdkSurface *surface,
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
GdkFrameTimings *timings;
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "frame event");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland frame event", NULL);
GDK_DISPLAY_DEBUG (GDK_DISPLAY (display_wayland), EVENTS, "frame %p", surface);
g_clear_pointer (&impl->frame_callback, wl_callback_destroy);

View File

@ -830,7 +830,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *wayland_toplevel)
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
maybe_set_gtk_surface_modal (wayland_toplevel);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
wl_surface_commit (wayland_surface->display_server.wl_surface);
}

View File

@ -1608,8 +1608,8 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
if (gdk_profiler_is_running ())
{
gdk_profiler_add_markf (start_time, GDK_PROFILER_CURRENT_TIME-start_time,
"Download Texture chunk",
gdk_profiler_end_markf (start_time,
"Download texture chunk",
"Tile %dx%d Size %dx%d", x, y, width, height);
start_time = GDK_PROFILER_CURRENT_TIME;
}
@ -1654,8 +1654,8 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
g_bytes_unref (bytes);
if (gdk_profiler_is_running ())
gdk_profiler_add_markf (start_time, GDK_PROFILER_CURRENT_TIME-start_time,
"Upload Texture chunk",
gdk_profiler_end_markf (start_time,
"Upload texture chunk",
"Tile %dx%d Size %dx%d", x, y, width, height);
}

View File

@ -424,7 +424,7 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
failure:
g_clear_object (&compiler);
gdk_profiler_end_mark (start_time, "load programs", NULL);
gdk_profiler_end_mark (start_time, "Load GL programs", NULL);
return ret;
}
@ -477,7 +477,7 @@ gsk_gl_driver_new (GskGLCommandQueue *command_queue,
self->icons_library = gsk_gl_icon_library_new (self);
self->shadows_library = gsk_gl_shadow_library_new (self);
gdk_profiler_end_mark (before, "create GskGLDriver", NULL);
gdk_profiler_end_mark (before, "Create GL driver", NULL);
return g_steal_pointer (&self);
}

View File

@ -376,7 +376,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
{
char message[64];
g_snprintf (message, sizeof message, "Size %dx%d", width, height);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload Glyph", message);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload glyph", message);
}
}

View File

@ -211,6 +211,6 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
{
char message[64];
g_snprintf (message, sizeof message, "Size %dx%d", width, height);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload Icon", message);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload icon", message);
}
}

View File

@ -4544,7 +4544,7 @@ gsk_gl_render_job_render (GskGLRenderJob *job,
gsk_gl_render_job_visit_node (job, root);
gdk_gl_context_pop_debug_group (job->command_queue->context);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Build GL command queue", "");
gdk_profiler_end_mark (start_time, "Build GL command queue", "");
#if 0
/* At this point the atlases have uploaded content while we processed
@ -4562,7 +4562,7 @@ gsk_gl_render_job_render (GskGLRenderJob *job,
gdk_gl_context_push_debug_group (job->command_queue->context, "Executing command queue");
gsk_gl_command_queue_execute (job->command_queue, surface_height, scale, job->region, job->default_framebuffer);
gdk_gl_context_pop_debug_group (job->command_queue->context);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Execute GL command queue", "");
gdk_profiler_end_mark (start_time, "Execute GL command queue", "");
}
static int

View File

@ -257,14 +257,14 @@ gtk_application_startup (GApplication *g_application)
before2 = GDK_PROFILER_CURRENT_TIME;
gtk_init ();
gdk_profiler_end_mark (before2, "gtk init", NULL);
gdk_profiler_end_mark (before2, "gtk_init", NULL);
priv->impl = gtk_application_impl_new (application, gdk_display_get_default ());
gtk_application_impl_startup (priv->impl, priv->register_session);
gtk_application_load_resources (application);
gdk_profiler_end_mark (before, "gtk application startup", NULL);
gdk_profiler_end_mark (before, "Application startup", NULL);
}
static void

View File

@ -2251,7 +2251,7 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
guint64 after = GDK_PROFILER_CURRENT_TIME;
if (after - before > 500000) /* half a millisecond */
{
gdk_profiler_add_mark (before, after - before, "builder load", filename);
gdk_profiler_add_mark (before, after - before, "Builder load", filename);
}
}
}

View File

@ -1363,7 +1363,7 @@ gtk_css_node_validate (GtkCssNode *cssnode)
if (GDK_PROFILER_IS_RUNNING)
{
gdk_profiler_end_mark (before, "css validation", "");
gdk_profiler_end_mark (before, "Validate CSS", "");
gdk_profiler_set_int_counter (invalidated_nodes_counter, invalidated_nodes);
gdk_profiler_set_int_counter (created_styles_counter, created_styles);
invalidated_nodes = 0;

View File

@ -1016,7 +1016,7 @@ gtk_css_provider_postprocess (GtkCssProvider *css_provider)
}
#endif
gdk_profiler_end_mark (before, "create selector tree", NULL);
gdk_profiler_end_mark (before, "Create CSS selector tree", NULL);
}
static void
@ -1081,7 +1081,7 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
if (GDK_PROFILER_IS_RUNNING)
{
char *uri = g_file_get_uri (file);
gdk_profiler_end_mark (before, "theme load", uri);
gdk_profiler_end_mark (before, "CSS theme load", uri);
g_free (uri);
}
}

View File

@ -761,7 +761,7 @@ populate_emoji_chooser (gpointer data)
now = g_get_monotonic_time ();
if (now > start + 200) /* 2 ms */
{
gdk_profiler_add_mark (start * 1000, (now - start) * 1000, "emojichooser", "populate");
gdk_profiler_add_mark (start * 1000, (now - start) * 1000, "Emojichooser populate", NULL);
return G_SOURCE_CONTINUE;
}
}
@ -771,7 +771,7 @@ populate_emoji_chooser (gpointer data)
chooser->box = NULL;
chooser->populate_idle = 0;
gdk_profiler_end_mark (start, "emojichooser", "populate (finish)");
gdk_profiler_end_mark (start, "Emojichooser populate (finish)", NULL);
return G_SOURCE_REMOVE;
}

View File

@ -2069,7 +2069,7 @@ ensure_valid_themes (GtkIconTheme *self,
load_themes (self);
gdk_profiler_end_mark (before, "icon theme load", self->current_theme);
gdk_profiler_end_mark (before, "Icon theme load", self->current_theme);
if (was_valid)
queue_theme_changed (self);
@ -3822,7 +3822,7 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
/* Don't report quick (< 0.5 msec) parses */
if (end - before > 500000 || !in_thread)
{
gdk_profiler_add_markf (before, (end - before), in_thread ? "icon load (thread)" : "icon load" ,
gdk_profiler_add_markf (before, (end - before), in_thread ? "Icon load (thread)" : "Icon load" ,
"%s size %d@%d", icon->filename, icon->desired_size, icon->desired_scale);
}
}

View File

@ -353,7 +353,7 @@ init_compose_table_thread_cb (GTask *task,
g_task_return_boolean (task, TRUE);
gdk_profiler_end_mark (before, "im compose table load (thread)", NULL);
gdk_profiler_end_mark (before, "Compose table load (thread)", NULL);
}
static void

View File

@ -549,7 +549,7 @@ do_post_parse_initialization (void)
gsk_render_node_init_types ();
_gtk_ensure_resources ();
gdk_profiler_end_mark (before, "basic initialization", NULL);
gdk_profiler_end_mark (before, "Basic initialization", NULL);
gtk_initialized = TRUE;
@ -559,13 +559,13 @@ do_post_parse_initialization (void)
#endif
gtk_im_modules_init ();
gtk_media_file_extension_init ();
gdk_profiler_end_mark (before, "init modules", NULL);
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);
gdk_profiler_end_mark (before, "Create display", NULL);
g_signal_connect (display_manager, "notify::default-display",
G_CALLBACK (default_display_notify_cb),

View File

@ -11956,7 +11956,7 @@ gtk_widget_render (GtkWidget *widget,
if (GDK_PROFILER_IS_RUNNING)
{
before_render = GDK_PROFILER_CURRENT_TIME;
gdk_profiler_add_mark (before_snapshot, (before_render - before_snapshot), "widget snapshot", "");
gdk_profiler_add_mark (before_snapshot, (before_render - before_snapshot), "Widget snapshot", "");
}
if (root != NULL)
@ -11972,7 +11972,7 @@ gtk_widget_render (GtkWidget *widget,
gsk_render_node_unref (root);
gdk_profiler_end_mark (before_render, "widget render", "");
gdk_profiler_end_mark (before_render, "Widget render", "");
}
}