[gnome-shell] Add a special background to use for performance testing
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Add a special background to use for performance testing
- Date: Mon, 18 Aug 2014 14:55:56 +0000 (UTC)
commit 20fc9735fab58a5d6fb6d9cf351b28765e945cb4
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Mon Aug 11 14:35:52 2014 +0200
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
.gitignore | 1 +
data/Makefile.am | 9 +++++++++
data/perf-background.xml.in | 31 +++++++++++++++++++++++++++++++
js/ui/background.js | 36 +++++++++++++++++++++++-------------
src/gnome-shell-perf-tool.in | 3 +++
5 files changed, 67 insertions(+), 13 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 987db1e..e0147ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@ data/gnome-shell-wayland.desktop.in
data/gnome-shell-extension-prefs.desktop
data/gnome-shell-extension-prefs.desktop.in
data/gschemas.compiled
+data/perf-background.xml
data/org.gnome.shell.gschema.xml
data/org.gnome.shell.gschema.valid
data/org.gnome.shell.evolution.calendar.gschema.xml
diff --git a/data/Makefile.am b/data/Makefile.am
index 1befb87..65f948a 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -74,6 +74,13 @@ dist_theme_DATA = \
theme/ws-switch-arrow-up.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@
keys_in_files = 50-gnome-shell-system.xml.in
keys_DATA = $(keys_in_files:.xml.in=.xml)
@@ -106,6 +113,7 @@ EXTRA_DIST = \
$(menu_DATA) \
$(convert_DATA) \
$(keys_in_files) \
+ perf-background.xml.in \
org.gnome.Shell.PortalHelper.desktop.in \
org.gnome.Shell.PortalHelper.service.in \
org.gnome.shell.gschema.xml.in.in
@@ -117,6 +125,7 @@ CLEANFILES += \
$(desktop_DATA) \
$(keys_DATA) \
$(gsettings_SCHEMAS) \
+ perf-background.xml \
gschemas.compiled \
org.gnome.shell.gschema.valid \
org.gnome.shell.gschema.xml.in
diff --git a/data/perf-background.xml.in b/data/perf-background.xml.in
new file mode 100644
index 0000000..752a552
--- /dev/null
+++ b/data/perf-background.xml.in
@@ -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>
diff --git a/js/ui/background.js b/js/ui/background.js
index 0212699..3fe0b7a 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -311,7 +311,8 @@ const Background = new Lang.Class({
params = Params.parse(params, { monitorIndex: 0,
layoutManager: Main.layoutManager,
effects: Meta.BackgroundEffects.NONE,
- settings: null });
+ settings: null,
+ overrideImage: null });
this.actor = new Meta.BackgroundGroup();
this.actor._delegate = this;
@@ -319,6 +320,7 @@ const Background = new Lang.Class({
Lang.bind(this, this._destroy));
this._settings = params.settings;
+ this._overrideImage = params.overrideImage;
this._monitorIndex = params.monitorIndex;
this._layoutManager = params.layoutManager;
this._effects = params.effects;
@@ -582,18 +584,23 @@ const Background = new Lang.Class({
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;
- if (GLib.uri_parse_scheme(uri) != null)
- filename = Gio.File.new_for_uri(uri).get_path();
- else
- filename = uri;
+ if (this._overrideImage != null) {
+ filename = this._overrideImage;
+ this._style = GDesktopEnums.BackgroundStyle.WALLPAPER; // Hardcode
+ } 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) {
this._setLoaded();
@@ -728,6 +735,8 @@ const BackgroundManager = new Lang.Class({
controlPosition: true,
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._container = params.container;
this._layoutManager = params.layoutManager;
@@ -789,7 +798,8 @@ const BackgroundManager = new Lang.Class({
let background = new Background({ monitorIndex: this._monitorIndex,
layoutManager: this._layoutManager,
effects: this._effects,
- settings: this._settings });
+ settings: this._settings,
+ overrideImage: this._overrideImage });
this._container.add_child(background.actor);
let monitor = this._layoutManager.monitors[this._monitorIndex];
diff --git a/src/gnome-shell-perf-tool.in b/src/gnome-shell-perf-tool.in
index 07374f6..3bb32dd 100644
--- a/src/gnome-shell-perf-tool.in
+++ b/src/gnome-shell-perf-tool.in
@@ -82,6 +82,9 @@ def start_shell(perf_output=None):
if perf_output is not None:
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]))
args = []
args.append(os.path.join(self_dir, 'gnome-shell'))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]