Make frame-timestamp logging optional

Instead of always logging frame timestamps for every frame - which
was using >26 bytes of memory per frame, or 5MB per hour of continuous
redrawing - make frame timestamps something that defaults off and is
turned turned on using a new ShellGlobal::frame-timestamps property by
the perf scripts.

https://bugzilla.gnome.org/show_bug.cgi?id=732350
This commit is contained in:
Owen W. Taylor 2014-06-26 20:34:15 -04:00
parent f0d4260c81
commit e30925995f
3 changed files with 41 additions and 9 deletions

View File

@ -72,6 +72,9 @@ function run() {
Scripting.defineScriptEvent("applicationsShowStart", "Starting to switch to applications view");
Scripting.defineScriptEvent("applicationsShowDone", "Done switching to applications view");
// Enable recording of timestamps for different points in the frame cycle
global.frame_timestamps = true;
Main.overview.connect('shown', function() {
Scripting.scriptEvent('overviewShowDone');
});

View File

@ -389,9 +389,17 @@ gnome_shell_plugin_xevent_filter (MetaPlugin *plugin,
* can send this with a ust of 0. Simplify life for consumers
* by ignoring such events */
if (swap_complete_event->ust != 0)
shell_perf_log_event_x (shell_perf_log_get_default (),
"glx.swapComplete",
swap_complete_event->ust);
{
gboolean frame_timestamps;
g_object_get (shell_plugin->global,
"frame-timestamps", &frame_timestamps,
NULL);
if (frame_timestamps)
shell_perf_log_event_x (shell_perf_log_get_default (),
"glx.swapComplete",
swap_complete_event->ust);
}
}
#endif

View File

@ -96,6 +96,7 @@ struct _ShellGlobal {
guint32 xdnd_timestamp;
gboolean has_modal;
gboolean frame_timestamps;
};
enum {
@ -116,6 +117,7 @@ enum {
PROP_IMAGEDIR,
PROP_USERDATADIR,
PROP_FOCUS_MANAGER,
PROP_FRAME_TIMESTAMPS,
};
/* Signals */
@ -146,6 +148,9 @@ shell_global_set_property(GObject *object,
g_clear_pointer (&global->session_mode, g_free);
global->session_mode = g_ascii_strdown (g_value_get_string (value), -1);
break;
case PROP_FRAME_TIMESTAMPS:
global->frame_timestamps = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -217,6 +222,9 @@ shell_global_get_property(GObject *object,
case PROP_FOCUS_MANAGER:
g_value_set_object (value, global->focus_manager);
break;
case PROP_FRAME_TIMESTAMPS:
g_value_set_boolean (value, global->frame_timestamps);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -500,6 +508,13 @@ shell_global_class_init (ShellGlobalClass *klass)
"The shell's StFocusManager",
ST_TYPE_FOCUS_MANAGER,
G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_FRAME_TIMESTAMPS,
g_param_spec_boolean ("frame-timestamps",
"Frame Timestamps",
"Whether to log frame timestamps in the performance log",
FALSE,
G_PARAM_READWRITE));
}
/*
@ -756,8 +771,11 @@ global_stage_notify_height (GObject *gobject,
static gboolean
global_stage_before_paint (gpointer data)
{
shell_perf_log_event (shell_perf_log_get_default (),
"clutter.stagePaintStart");
ShellGlobal *global = SHELL_GLOBAL (data);
if (global->frame_timestamps)
shell_perf_log_event (shell_perf_log_get_default (),
"clutter.stagePaintStart");
return TRUE;
}
@ -765,8 +783,11 @@ global_stage_before_paint (gpointer data)
static gboolean
global_stage_after_paint (gpointer data)
{
shell_perf_log_event (shell_perf_log_get_default (),
"clutter.stagePaintDone");
ShellGlobal *global = SHELL_GLOBAL (data);
if (global->frame_timestamps)
shell_perf_log_event (shell_perf_log_get_default (),
"clutter.stagePaintDone");
return TRUE;
}
@ -951,11 +972,11 @@ _shell_global_set_plugin (ShellGlobal *global,
clutter_threads_add_repaint_func_full (CLUTTER_REPAINT_FLAGS_PRE_PAINT,
global_stage_before_paint,
NULL, NULL);
global, NULL);
clutter_threads_add_repaint_func_full (CLUTTER_REPAINT_FLAGS_POST_PAINT,
global_stage_after_paint,
NULL, NULL);
global, NULL);
shell_perf_log_define_event (shell_perf_log_get_default(),
"clutter.stagePaintStart",