mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-14 20:51:07 +00:00
Merge branch 'cleanup-profiler-marks' into 'master'
Cleanup profiler marks See merge request GNOME/gtk!1417
This commit is contained in:
commit
d702c159d5
@ -125,7 +125,7 @@ _gdk_broadway_roundtrip_notify (GdkSurface *surface,
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
_gdk_frame_clock_debug_print_timings (clock, timings);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
_gdk_frame_clock_add_timings_to_profiler (clock, timings);
|
||||
#endif
|
||||
}
|
||||
|
@ -383,9 +383,9 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->end_frame (context, priv->frame_region);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_set_int_counter (pixels_counter,
|
||||
g_get_monotonic_time () * 1000,
|
||||
g_get_monotonic_time (),
|
||||
region_get_pixels (priv->frame_region));
|
||||
#endif
|
||||
|
||||
|
@ -647,29 +647,13 @@ gdk_frame_clock_get_refresh_info (GdkFrameClock *frame_clock,
|
||||
void
|
||||
_gdk_frame_clock_emit_flush_events (GdkFrameClock *frame_clock)
|
||||
{
|
||||
gint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_signal_emit (frame_clock, signals[FLUSH_EVENTS], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
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)
|
||||
{
|
||||
gint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_signal_emit (frame_clock, signals[BEFORE_PAINT], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
gint64 after = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "before-paint");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -679,11 +663,8 @@ _gdk_frame_clock_emit_update (GdkFrameClock *frame_clock)
|
||||
|
||||
g_signal_emit (frame_clock, signals[UPDATE], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
gint64 after = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "update");
|
||||
}
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (before, "frameclock update", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -693,11 +674,8 @@ _gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock)
|
||||
|
||||
g_signal_emit (frame_clock, signals[LAYOUT], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
gint64 after = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "layout");
|
||||
}
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (before, "frameclock layout", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -707,39 +685,20 @@ _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
|
||||
|
||||
g_signal_emit (frame_clock, signals[PAINT], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
gint64 after = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "paint");
|
||||
}
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (before, "frameclock paint", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_frame_clock_emit_after_paint (GdkFrameClock *frame_clock)
|
||||
{
|
||||
gint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_signal_emit (frame_clock, signals[AFTER_PAINT], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
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)
|
||||
{
|
||||
gint64 before = g_get_monotonic_time ();
|
||||
|
||||
g_signal_emit (frame_clock, signals[RESUME_EVENTS], 0);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
gint64 after = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "frameclock", "resume-events");
|
||||
}
|
||||
}
|
||||
|
||||
static gint64
|
||||
@ -818,9 +777,9 @@ _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *clock,
|
||||
{
|
||||
if (timings->presentation_time != 0)
|
||||
{
|
||||
gdk_profiler_add_mark (timings->presentation_time * 1000, 0, "frameclock", "presentation");
|
||||
gdk_profiler_add_mark (timings->presentation_time, 0, "presented window", NULL);
|
||||
gdk_profiler_set_counter (fps_counter,
|
||||
timings->presentation_time * 1000,
|
||||
timings->presentation_time,
|
||||
frame_clock_get_fps (clock));
|
||||
}
|
||||
}
|
||||
|
@ -501,8 +501,8 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
if (priv->freeze_count == 0)
|
||||
priv->sleep_serial = get_sleep_serial ();
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "frameclock", "paint_idle");
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (before, "frameclock cycle", NULL);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -565,7 +565,7 @@ gdk_frame_clock_idle_freeze (GdkFrameClock *clock)
|
||||
|
||||
if (priv->freeze_count == 0)
|
||||
{
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
priv->freeze_time = g_get_monotonic_time ();
|
||||
}
|
||||
|
||||
@ -594,14 +594,12 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
|
||||
|
||||
priv->sleep_serial = get_sleep_serial ();
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
if (priv->freeze_time != 0)
|
||||
{
|
||||
gint64 thaw_time = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (priv->freeze_time * 1000,
|
||||
(thaw_time - priv->freeze_time) * 1000,
|
||||
"frameclock freeze", "");
|
||||
gdk_profiler_end_mark (priv->freeze_time,
|
||||
"frameclock frozen", NULL);
|
||||
priv->freeze_time = 0;
|
||||
}
|
||||
}
|
||||
|
@ -94,12 +94,84 @@ gdk_profiler_add_mark (gint64 start,
|
||||
return;
|
||||
|
||||
sysprof_capture_writer_add_mark (writer,
|
||||
start,
|
||||
start * 1000L,
|
||||
-1, getpid (),
|
||||
duration,
|
||||
duration * 1000L,
|
||||
"gtk", name, message);
|
||||
}
|
||||
|
||||
static void add_markvf (gint64 start,
|
||||
guint64 duration,
|
||||
const char *name,
|
||||
const char *format,
|
||||
va_list args) G_GNUC_PRINTF(4, 0);
|
||||
|
||||
static void
|
||||
add_markvf (gint64 start,
|
||||
guint64 duration,
|
||||
const char *name,
|
||||
const char *format,
|
||||
va_list args)
|
||||
{
|
||||
char *message;
|
||||
message = g_strdup_vprintf (format, args);
|
||||
sysprof_capture_writer_add_mark (writer,
|
||||
start * 1000L,
|
||||
-1, getpid (),
|
||||
duration * 1000L,
|
||||
"gtk", name, message);
|
||||
g_free (message);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_profiler_add_markf (gint64 start,
|
||||
guint64 duration,
|
||||
const char *name,
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if (!running)
|
||||
return;
|
||||
|
||||
va_start (args, format);
|
||||
add_markvf (start, duration, name, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_profiler_end_mark (gint64 start,
|
||||
const char *name,
|
||||
const char *message)
|
||||
{
|
||||
if (!running)
|
||||
return;
|
||||
|
||||
sysprof_capture_writer_add_mark (writer,
|
||||
start * 1000L,
|
||||
-1, getpid (),
|
||||
(g_get_monotonic_time () - start) * 1000L,
|
||||
"gtk", name, message);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_profiler_end_markf (gint64 start,
|
||||
const char *name,
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if (!running)
|
||||
return;
|
||||
|
||||
va_start (args, format);
|
||||
add_markvf (start, g_get_monotonic_time () - start, name, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
|
||||
static guint
|
||||
define_counter (const char *name,
|
||||
const char *description,
|
||||
@ -153,7 +225,7 @@ gdk_profiler_set_counter (guint id,
|
||||
|
||||
value.vdbl = val;
|
||||
sysprof_capture_writer_set_counters (writer,
|
||||
time,
|
||||
time * 1000L,
|
||||
-1, getpid (),
|
||||
&id, &value, 1);
|
||||
}
|
||||
@ -170,7 +242,7 @@ gdk_profiler_set_int_counter (guint id,
|
||||
|
||||
value.v64 = val;
|
||||
sysprof_capture_writer_set_counters (writer,
|
||||
time,
|
||||
time * 1000L,
|
||||
-1, getpid (),
|
||||
&id, &value, 1);
|
||||
}
|
||||
@ -201,6 +273,30 @@ gdk_profiler_add_mark (gint64 start,
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gdk_profiler_add_markf (gint64 start,
|
||||
guint64 duration,
|
||||
const char *name,
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gdk_profiler_end_mark (gint64 start,
|
||||
const char *name,
|
||||
const char *message)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gdk_profiler_end_markf (gint64 start,
|
||||
const char *name,
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
}
|
||||
|
||||
guint
|
||||
gdk_profiler_define_counter (const char *name,
|
||||
const char *description)
|
||||
|
@ -23,6 +23,21 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* Ensure we included config.h as needed for the below HAVE_SYSPROF_CAPTURE check */
|
||||
#ifndef GETTEXT_PACKAGE
|
||||
#error "config.h was not included before gdkprofilerprivate.h."
|
||||
#endif
|
||||
|
||||
/* We make this a macro you use as if (GDK_PROFILER_IS_RUNNING) because that
|
||||
* way we can ensure all the code is compiled out when not supported, and
|
||||
* we can add a G_UNLIKELY() for better codegen if it is.
|
||||
*/
|
||||
#ifdef HAVE_SYSPROF_CAPTURE
|
||||
#define GDK_PROFILER_IS_RUNNING G_UNLIKELY (gdk_profiler_is_running ())
|
||||
#else
|
||||
#define GDK_PROFILER_IS_RUNNING FALSE
|
||||
#endif
|
||||
|
||||
void gdk_profiler_start (int fd);
|
||||
void gdk_profiler_stop (void);
|
||||
gboolean gdk_profiler_is_running (void);
|
||||
@ -30,6 +45,18 @@ void gdk_profiler_add_mark (gint64 start,
|
||||
guint64 duration,
|
||||
const char *name,
|
||||
const char *message);
|
||||
void gdk_profiler_add_markf (gint64 start,
|
||||
guint64 duration,
|
||||
const char *name,
|
||||
const char *format,
|
||||
...) G_GNUC_PRINTF (4, 5);
|
||||
void gdk_profiler_end_mark (gint64 start,
|
||||
const char *name,
|
||||
const char *message);
|
||||
void gdk_profiler_end_markf (gint64 start,
|
||||
const char *name,
|
||||
const char *format,
|
||||
...) G_GNUC_PRINTF (3, 4);
|
||||
guint gdk_profiler_define_counter (const char *name,
|
||||
const char *description);
|
||||
void gdk_profiler_set_counter (guint id,
|
||||
|
@ -4103,15 +4103,9 @@ add_event_mark (GdkEvent *event,
|
||||
}
|
||||
|
||||
if (kind != NULL && message != NULL)
|
||||
{
|
||||
gchar *full_message = g_strdup_printf ("%s %s", kind, message);
|
||||
gdk_profiler_add_mark (time * 1000L, duration * 1000L, "event", full_message);
|
||||
g_free (full_message);
|
||||
}
|
||||
gdk_profiler_add_markf (time, duration, "event", "%s %s", kind, message);
|
||||
else
|
||||
{
|
||||
gdk_profiler_add_mark (time * 1000L, duration * 1000L, "event", message ? message : kind);
|
||||
}
|
||||
gdk_profiler_add_mark (time, duration, "event", message ? message : kind);
|
||||
|
||||
g_free (message);
|
||||
}
|
||||
@ -4138,7 +4132,7 @@ gdk_surface_handle_event (GdkEvent *event)
|
||||
g_signal_emit (gdk_event_get_surface (event), signals[EVENT], 0, event, &handled);
|
||||
}
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
add_event_mark (event, begin_time, g_get_monotonic_time () - begin_time);
|
||||
|
||||
return handled;
|
||||
|
@ -1153,10 +1153,8 @@ _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);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "wayland", "load cursor theme");
|
||||
}
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (before, "wayland", "load cursor theme");
|
||||
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "swap buffers");
|
||||
gdk_profiler_add_mark (g_get_monotonic_time (), 0, "wayland", "swap buffers");
|
||||
if (display_wayland->have_egl_swap_buffers_with_damage)
|
||||
{
|
||||
int i, j, n_rects = cairo_region_num_rectangles (painted);
|
||||
|
@ -357,7 +357,7 @@ frame_callback (void *data,
|
||||
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
|
||||
GdkFrameTimings *timings;
|
||||
|
||||
gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "frame event");
|
||||
gdk_profiler_add_mark (g_get_monotonic_time (), 0, "wayland", "frame event");
|
||||
GDK_DISPLAY_NOTE (GDK_DISPLAY (display_wayland), EVENTS, g_message ("frame %p", surface));
|
||||
|
||||
wl_callback_destroy (callback);
|
||||
@ -398,7 +398,7 @@ frame_callback (void *data,
|
||||
_gdk_frame_clock_debug_print_timings (clock, timings);
|
||||
#endif
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
_gdk_frame_clock_add_timings_to_profiler (clock, timings);
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ on_frame_clock_after_paint (GdkFrameClock *clock,
|
||||
* before we need to stage any changes, then we can take it back and
|
||||
* use it again.
|
||||
*/
|
||||
gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "surface commit");
|
||||
gdk_profiler_add_mark (g_get_monotonic_time (), 0, "wayland", "surface commit");
|
||||
wl_surface_commit (impl->display_server.wl_surface);
|
||||
|
||||
impl->pending_commit = FALSE;
|
||||
@ -1510,7 +1510,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
|
||||
if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG)
|
||||
_gdk_wayland_screen_add_orphan_dialog (surface);
|
||||
|
||||
gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "surface commit");
|
||||
gdk_profiler_add_mark (g_get_monotonic_time (), 0, "wayland", "surface commit");
|
||||
wl_surface_commit (impl->display_server.wl_surface);
|
||||
}
|
||||
|
||||
@ -2305,7 +2305,7 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
|
||||
}
|
||||
}
|
||||
|
||||
gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "surface commit");
|
||||
gdk_profiler_add_mark (g_get_monotonic_time (), 0, "wayland", "surface commit");
|
||||
wl_surface_commit (impl->display_server.wl_surface);
|
||||
|
||||
impl->popup_parent = parent;
|
||||
|
@ -881,6 +881,9 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
gdk_surface_freeze_updates (surface);
|
||||
|
||||
_gdk_x11_surface_grab_check_unmap (surface, xevent->xany.serial);
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_add_markf (g_get_monotonic_time (), 0, "unmapped window", "0x%lx", GDK_SURFACE_XID (surface));
|
||||
}
|
||||
|
||||
return_val = FALSE;
|
||||
@ -902,6 +905,12 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
if (toplevel)
|
||||
gdk_surface_thaw_updates (surface);
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
gdk_profiler_end_markf (surface_impl->map_time, "mapped window", "0x%lx", GDK_SURFACE_XID (surface));
|
||||
surface_impl->map_time = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return_val = FALSE;
|
||||
@ -1284,7 +1293,7 @@ _gdk_wm_protocols_filter (const XEvent *xevent,
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, FRAMES))
|
||||
_gdk_frame_clock_debug_print_timings (clock, timings);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
_gdk_frame_clock_add_timings_to_profiler (clock, timings);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
}
|
||||
|
@ -1205,6 +1205,7 @@ gdk_x11_surface_show (GdkSurface *surface, gboolean already_mapped)
|
||||
GdkToplevelX11 *toplevel;
|
||||
Display *xdisplay = GDK_SURFACE_XDISPLAY (surface);
|
||||
Window xwindow = GDK_SURFACE_XID (surface);
|
||||
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
if (!already_mapped)
|
||||
set_initial_hints (surface);
|
||||
@ -1217,7 +1218,13 @@ gdk_x11_surface_show (GdkSurface *surface, gboolean already_mapped)
|
||||
display_x11->user_time != 0 &&
|
||||
XSERVER_TIME_IS_LATER (display_x11->user_time, toplevel->user_time))
|
||||
gdk_x11_surface_set_user_time (surface, display_x11->user_time);
|
||||
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
if (impl->map_time == 0)
|
||||
impl->map_time = g_get_monotonic_time ();
|
||||
}
|
||||
|
||||
XMapWindow (xdisplay, xwindow);
|
||||
|
||||
/* Fullscreen on current monitor is the default, no need to apply this mode
|
||||
|
@ -78,6 +78,8 @@ struct _GdkX11Surface
|
||||
|
||||
int abs_x;
|
||||
int abs_y;
|
||||
|
||||
guint64 map_time;
|
||||
};
|
||||
|
||||
struct _GdkX11SurfaceClass
|
||||
|
@ -171,5 +171,5 @@ gsk_gl_profiler_end_gpu_region (GskGLProfiler *profiler)
|
||||
else
|
||||
elapsed = 0;
|
||||
|
||||
return elapsed;
|
||||
return elapsed / 1000; /* Convert to usec to match other profiler APIs */
|
||||
}
|
||||
|
@ -2857,8 +2857,8 @@ gsk_gl_renderer_realize (GskRenderer *renderer,
|
||||
self->icon_cache = get_icon_cache_for_display (gdk_surface_get_display (surface), self->atlases);
|
||||
gsk_gl_shadow_cache_init (&self->shadow_cache);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "gl renderer realize", NULL);
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (before, "gl renderer realize", NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -3561,7 +3561,7 @@ gsk_gl_renderer_do_render (GskRenderer *renderer,
|
||||
|
||||
gsk_profiler_push_samples (profiler);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_add_mark (start_time, cpu_time, "GL render", "");
|
||||
|
||||
#endif
|
||||
|
@ -262,7 +262,7 @@ gsk_profiler_timer_begin (GskProfiler *profiler,
|
||||
return;
|
||||
|
||||
timer->in_flight = TRUE;
|
||||
timer->start_time = g_get_monotonic_time () * 1000;
|
||||
timer->start_time = g_get_monotonic_time ();
|
||||
}
|
||||
|
||||
gint64
|
||||
@ -289,7 +289,7 @@ gsk_profiler_timer_end (GskProfiler *profiler,
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff = (g_get_monotonic_time () * 1000) - timer->start_time;
|
||||
diff = g_get_monotonic_time () - timer->start_time;
|
||||
|
||||
timer->in_flight = FALSE;
|
||||
timer->value += diff;
|
||||
@ -360,7 +360,7 @@ gsk_profiler_timer_get (GskProfiler *profiler,
|
||||
}
|
||||
|
||||
if (timer->invert)
|
||||
return (gint64) (1000000000.0 / (double) timer->value);
|
||||
return (gint64) (1000000.0 / (double) timer->value);
|
||||
|
||||
return timer->value;
|
||||
}
|
||||
@ -437,7 +437,7 @@ gsk_profiler_push_samples (GskProfiler *profiler)
|
||||
s->id = timer->id;
|
||||
|
||||
if (timer->invert)
|
||||
s->value = (gint64) (1000000000.0 / (double) timer->value);
|
||||
s->value = (gint64) (1000000.0 / (double) timer->value);
|
||||
else
|
||||
s->value = timer->value;
|
||||
}
|
||||
@ -506,20 +506,19 @@ gsk_profiler_append_timers (GskProfiler *profiler,
|
||||
{
|
||||
NamedTimer *timer = value_p;
|
||||
const char *unit = timer->invert ? "" : "usec";
|
||||
double scale = timer->invert ? 1.0 : 1000.0;
|
||||
|
||||
g_string_append_printf (buffer, "%s (%s): %.2f",
|
||||
timer->description,
|
||||
unit,
|
||||
(double) timer->value / scale);
|
||||
(double) timer->value);
|
||||
|
||||
if (timer->n_samples > 1)
|
||||
{
|
||||
timer->avg_value = timer->avg_value / timer->n_samples;
|
||||
g_string_append_printf (buffer, " Min: %.2f Avg: %.2f Max: %.2f (%" G_GINT64_FORMAT " samples)",
|
||||
(double) timer->min_value / scale,
|
||||
(double) timer->avg_value / scale,
|
||||
(double) timer->max_value / scale,
|
||||
(double) timer->min_value,
|
||||
(double) timer->avg_value,
|
||||
(double) timer->max_value,
|
||||
timer->n_samples);
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ gsk_vulkan_renderer_render_texture (GskRenderer *renderer,
|
||||
|
||||
gsk_profiler_push_samples (profiler);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
gdk_profiler_add_mark (start_time, cpu_time, "render", "");
|
||||
gdk_profiler_set_int_counter (texture_pixels_counter,
|
||||
|
@ -306,16 +306,16 @@ gtk_application_startup (GApplication *g_application)
|
||||
|
||||
before2 = g_get_monotonic_time ();
|
||||
gtk_init ();
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before2 * 1000, (g_get_monotonic_time () - before2) * 1000, "gtk init", NULL);
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
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);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "gtk application startup", NULL);
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (before, "gtk application startup", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -590,7 +590,7 @@ sysprof_profiler_method_call (GDBusConnection *connection,
|
||||
int fd = -1;
|
||||
int idx;
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
G_DBUS_ERROR,
|
||||
@ -612,7 +612,7 @@ sysprof_profiler_method_call (GDBusConnection *connection,
|
||||
}
|
||||
else if (strcmp (method_name, "Stop") == 0)
|
||||
{
|
||||
if (!gdk_profiler_is_running ())
|
||||
if (!GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
G_DBUS_ERROR,
|
||||
|
@ -1625,5 +1625,10 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
|
||||
/* restore the original domain */
|
||||
gtk_builder_set_translation_domain (builder, domain);
|
||||
|
||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "builder load", filename);
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
guint64 after = g_get_monotonic_time ();
|
||||
if (after - before > 500)
|
||||
gdk_profiler_add_mark (before, after - before, "builder load", filename);
|
||||
}
|
||||
}
|
||||
|
@ -1351,12 +1351,12 @@ gtk_css_node_validate (GtkCssNode *cssnode)
|
||||
|
||||
gtk_css_node_validate_internal (cssnode, &filter, timestamp);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
gint64 after = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "css validation", "");
|
||||
gdk_profiler_set_int_counter (invalidated_nodes_counter, after * 1000, invalidated_nodes);
|
||||
gdk_profiler_set_int_counter (created_styles_counter, after * 1000, created_styles);
|
||||
gdk_profiler_add_mark (before, (after - before), "css validation", "");
|
||||
gdk_profiler_set_int_counter (invalidated_nodes_counter, after, invalidated_nodes);
|
||||
gdk_profiler_set_int_counter (created_styles_counter, after, created_styles);
|
||||
invalidated_nodes = 0;
|
||||
created_styles = 0;
|
||||
}
|
||||
|
@ -1009,8 +1009,8 @@ gtk_css_provider_postprocess (GtkCssProvider *css_provider)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "create selector tree", NULL);
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (before, "create selector tree", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1068,10 +1068,10 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
char *uri = g_file_get_uri (file);
|
||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "theme load", uri);
|
||||
gdk_profiler_end_mark (before, "theme load", uri);
|
||||
g_free (uri);
|
||||
}
|
||||
}
|
||||
|
@ -465,8 +465,8 @@ populate_emoji_chooser (gpointer data)
|
||||
now = g_get_monotonic_time ();
|
||||
if (now > start + 8000)
|
||||
{
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (start * 1000, (now - start) * 1000, "emojichooser", "populate");
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_add_mark (start, (now - start), "emojichooser", "populate");
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
}
|
||||
@ -476,11 +476,8 @@ populate_emoji_chooser (gpointer data)
|
||||
chooser->box = NULL;
|
||||
chooser->populate_idle = 0;
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
now = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (start * 1000, (now - start) * 1000, "emojichooser", "populate (finish)");
|
||||
}
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (start, "emojichooser", "populate (finish)");
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
@ -1846,8 +1846,8 @@ ensure_valid_themes (GtkIconTheme *self,
|
||||
|
||||
load_themes (self);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "icon theme load", self->current_theme);
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (before, "icon theme load", self->current_theme);
|
||||
|
||||
if (was_valid)
|
||||
queue_theme_changed (self);
|
||||
@ -3605,11 +3605,13 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
||||
|
||||
g_assert (icon->texture != NULL);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
char *message = g_strdup_printf ("%s size %d@%d", icon->filename, icon->desired_size, icon->desired_scale);
|
||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, in_thread ? "icon load (thread)" : "icon load" , message);
|
||||
g_free (message);
|
||||
guint64 end = g_get_monotonic_time ();
|
||||
/* Don't report quick (< 0.5 msec) parses */
|
||||
if (end - before > 500 || !in_thread)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12177,8 +12177,8 @@ gtk_widget_render (GtkWidget *widget,
|
||||
GskRenderer *renderer;
|
||||
GskRenderNode *root;
|
||||
int x, y;
|
||||
gint64 before = g_get_monotonic_time ();
|
||||
gint64 after = 0;
|
||||
gint64 before_snapshot = g_get_monotonic_time ();
|
||||
gint64 before_render = 0;
|
||||
|
||||
if (!GTK_IS_NATIVE (widget))
|
||||
return;
|
||||
@ -12193,10 +12193,10 @@ gtk_widget_render (GtkWidget *widget,
|
||||
gtk_widget_snapshot (widget, snapshot);
|
||||
root = gtk_snapshot_free_to_node (snapshot);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
after = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "widget snapshot", "");
|
||||
before_render = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (before_snapshot, (before_render - before_snapshot), "widget snapshot", "");
|
||||
}
|
||||
|
||||
if (root != NULL)
|
||||
@ -12211,12 +12211,8 @@ gtk_widget_render (GtkWidget *widget,
|
||||
|
||||
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, "widget render", "");
|
||||
}
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (before_render, "widget render", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6316,11 +6316,8 @@ gtk_window_check_resize (GtkWindow *self)
|
||||
else if (gtk_widget_get_visible (widget))
|
||||
gtk_window_move_resize (self);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
gint64 after = g_get_monotonic_time ();
|
||||
gdk_profiler_add_mark (before * 1000, (after - before) * 1000, "size allocation", "");
|
||||
}
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
gdk_profiler_end_mark (before, "size allocation", "");
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user