Add a special background to use for performance testing

Performance testing was producing inconsistent values at different
times in the day since the GNOME default background is animated and
sometimes has a single layer, and sometimes two blended layers.

So we have consistent numbers, install a simple animated background
with GNOME Shell that has 40-year long transition ending in 2030,a
and set an environment variable in gnome-shell-perf-tool so that the
background is override with that background. (The background depends
on files installed by gnome-backgrounds; we assume that the person
running performance tests is doing so within the scope of a full
GNOME install.)

https://bugzilla.gnome.org/show_bug.cgi?id=734610
This commit is contained in:
Owen W. Taylor 2014-08-11 14:35:52 +02:00
parent d450b74e10
commit 20fc9735fa
5 changed files with 67 additions and 13 deletions

1
.gitignore vendored
View File

@ -24,6 +24,7 @@ data/gnome-shell-wayland.desktop.in
data/gnome-shell-extension-prefs.desktop data/gnome-shell-extension-prefs.desktop
data/gnome-shell-extension-prefs.desktop.in data/gnome-shell-extension-prefs.desktop.in
data/gschemas.compiled data/gschemas.compiled
data/perf-background.xml
data/org.gnome.shell.gschema.xml data/org.gnome.shell.gschema.xml
data/org.gnome.shell.gschema.valid data/org.gnome.shell.gschema.valid
data/org.gnome.shell.evolution.calendar.gschema.xml data/org.gnome.shell.evolution.calendar.gschema.xml

View File

@ -74,6 +74,13 @@ dist_theme_DATA = \
theme/ws-switch-arrow-up.png \ theme/ws-switch-arrow-up.png \
theme/ws-switch-arrow-down.png theme/ws-switch-arrow-down.png
backgrounddir = $(pkgdatadir)
background_DATA = perf-background.xml
perf-background.xml: perf-background.xml.in
$(AM_V_GEN) sed -e "s|@datadir[@]|$(datadir)|" \
$< > $@ || rm $@
keysdir = @GNOME_KEYBINDINGS_KEYSDIR@ keysdir = @GNOME_KEYBINDINGS_KEYSDIR@
keys_in_files = 50-gnome-shell-system.xml.in keys_in_files = 50-gnome-shell-system.xml.in
keys_DATA = $(keys_in_files:.xml.in=.xml) keys_DATA = $(keys_in_files:.xml.in=.xml)
@ -106,6 +113,7 @@ EXTRA_DIST = \
$(menu_DATA) \ $(menu_DATA) \
$(convert_DATA) \ $(convert_DATA) \
$(keys_in_files) \ $(keys_in_files) \
perf-background.xml.in \
org.gnome.Shell.PortalHelper.desktop.in \ org.gnome.Shell.PortalHelper.desktop.in \
org.gnome.Shell.PortalHelper.service.in \ org.gnome.Shell.PortalHelper.service.in \
org.gnome.shell.gschema.xml.in.in org.gnome.shell.gschema.xml.in.in
@ -117,6 +125,7 @@ CLEANFILES += \
$(desktop_DATA) \ $(desktop_DATA) \
$(keys_DATA) \ $(keys_DATA) \
$(gsettings_SCHEMAS) \ $(gsettings_SCHEMAS) \
perf-background.xml \
gschemas.compiled \ gschemas.compiled \
org.gnome.shell.gschema.valid \ org.gnome.shell.gschema.valid \
org.gnome.shell.gschema.xml.in org.gnome.shell.gschema.xml.in

View File

@ -0,0 +1,31 @@
<!-- With an animated background, performance will differ depending on whether
one layer or two layers are being blended together. This messes up our
benchmarks. We could just benchmark a single image, but since blended
images are present for much of the day with the GNOME default background,
we want to make sure that also performs well; for that reason we ship
an "animated" background that animates super-slowly to use during
performance tests; it will be in the blended state until 2030. -->
<background>
<starttime>
<year>1990</year>
<month>1</month>
<day>1</day>
<hour>0</hour>
<minute>00</minute>
<second>00</second>
</starttime>
<!-- One transition that takes 40 years -->
<transition type="overlay">
<duration>1261440000.0</duration>
<from>@datadir@/backgrounds/gnome/adwaita-morning.jpg</from>
<to>@datadir@/backgrounds/gnome/adwaita-day.jpg</to>
</transition>
<!-- A single slide doesn't work, so another slide for 1 minute after 40 years -->
<static>
<duration>60</duration>
<file>/usr/share/backgrounds/gnome/Sandstone.jpg</file>
</static>
</background>

View File

@ -311,7 +311,8 @@ const Background = new Lang.Class({
params = Params.parse(params, { monitorIndex: 0, params = Params.parse(params, { monitorIndex: 0,
layoutManager: Main.layoutManager, layoutManager: Main.layoutManager,
effects: Meta.BackgroundEffects.NONE, effects: Meta.BackgroundEffects.NONE,
settings: null }); settings: null,
overrideImage: null });
this.actor = new Meta.BackgroundGroup(); this.actor = new Meta.BackgroundGroup();
this.actor._delegate = this; this.actor._delegate = this;
@ -319,6 +320,7 @@ const Background = new Lang.Class({
Lang.bind(this, this._destroy)); Lang.bind(this, this._destroy));
this._settings = params.settings; this._settings = params.settings;
this._overrideImage = params.overrideImage;
this._monitorIndex = params.monitorIndex; this._monitorIndex = params.monitorIndex;
this._layoutManager = params.layoutManager; this._layoutManager = params.layoutManager;
this._effects = params.effects; this._effects = params.effects;
@ -582,18 +584,23 @@ const Background = new Lang.Class({
this._loadPattern(); this._loadPattern();
this._style = this._settings.get_enum(BACKGROUND_STYLE_KEY);
if (this._style == GDesktopEnums.BackgroundStyle.NONE) {
this._setLoaded();
return;
}
let uri = this._settings.get_string(PICTURE_URI_KEY);
let filename; let filename;
if (GLib.uri_parse_scheme(uri) != null) if (this._overrideImage != null) {
filename = Gio.File.new_for_uri(uri).get_path(); filename = this._overrideImage;
else this._style = GDesktopEnums.BackgroundStyle.WALLPAPER; // Hardcode
filename = uri; } else {
this._style = this._settings.get_enum(BACKGROUND_STYLE_KEY);
if (this._style == GDesktopEnums.BackgroundStyle.NONE) {
this._setLoaded();
return;
}
let uri = this._settings.get_string(PICTURE_URI_KEY);
if (GLib.uri_parse_scheme(uri) != null)
filename = Gio.File.new_for_uri(uri).get_path();
else
filename = uri;
}
if (!filename) { if (!filename) {
this._setLoaded(); this._setLoaded();
@ -728,6 +735,8 @@ const BackgroundManager = new Lang.Class({
controlPosition: true, controlPosition: true,
settingsSchema: BACKGROUND_SCHEMA }); settingsSchema: BACKGROUND_SCHEMA });
// Allow override the background image setting for performance testing
this._overrideImage = GLib.getenv('SHELL_BACKGROUND_IMAGE');
this._settings = new Gio.Settings({ schema_id: params.settingsSchema }); this._settings = new Gio.Settings({ schema_id: params.settingsSchema });
this._container = params.container; this._container = params.container;
this._layoutManager = params.layoutManager; this._layoutManager = params.layoutManager;
@ -789,7 +798,8 @@ const BackgroundManager = new Lang.Class({
let background = new Background({ monitorIndex: this._monitorIndex, let background = new Background({ monitorIndex: this._monitorIndex,
layoutManager: this._layoutManager, layoutManager: this._layoutManager,
effects: this._effects, effects: this._effects,
settings: this._settings }); settings: this._settings,
overrideImage: this._overrideImage });
this._container.add_child(background.actor); this._container.add_child(background.actor);
let monitor = this._layoutManager.monitors[this._monitorIndex]; let monitor = this._layoutManager.monitors[this._monitorIndex];

View File

@ -82,6 +82,9 @@ def start_shell(perf_output=None):
if perf_output is not None: if perf_output is not None:
env['SHELL_PERF_OUTPUT'] = perf_output env['SHELL_PERF_OUTPUT'] = perf_output
# A fixed background image
env['SHELL_BACKGROUND_IMAGE'] = '@pkgdatadir@/perf-background.xml'
self_dir = os.path.dirname(os.path.abspath(sys.argv[0])) self_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
args = [] args = []
args.append(os.path.join(self_dir, 'gnome-shell')) args.append(os.path.join(self_dir, 'gnome-shell'))