[gegl] perf: update performance testing framework
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] perf: update performance testing framework
- Date: Fri, 13 Jun 2014 20:20:56 +0000 (UTC)
commit c8af348db926daed498a7ca809efd9baf271ab1e
Author: Øyvind Kolås <pippin gimp org>
Date: Thu Jun 12 23:09:18 2014 +0200
perf: update performance testing framework
configure.ac | 1 +
gegl/buffer/gegl-sampler.c | 3 +-
perf/Makefile | 59 --------------
perf/Makefile-retrospect | 81 ++++++++++++++++++++
perf/Makefile-tests | 15 ++++
perf/Makefile.am | 47 +++++++++++
perf/README | 22 -----
perf/create-report.rb | 25 ++++---
perf/joblist | 11 +++
perf/makejobs.rb | 24 ++++++
...rast-minichunk.c => test-bcontrast-minichunk.c} | 0
perf/{tests/bcontrast.c => test-bcontrast.c} | 0
perf/{tests/blur.c => test-blur.c} | 0
perf/{tests => }/test-common.h | 12 ++-
perf/{tests => }/test-gegl-buffer-access.c | 16 +++--
perf/{tests/passthrough.c => test-passthrough.c} | 0
perf/test-rotate.c | 42 ++++++++++
perf/{tests/unsharpmask.c => test-unsharpmask.c} | 0
perf/tests/Makefile | 16 ----
perf/tests/bblur.c | 25 ------
perf/tests/cc.cc | 58 --------------
perf/tests/comp.c | 32 --------
perf/tests/rotate.c | 25 ------
23 files changed, 256 insertions(+), 258 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 82fa9b8..3e18a6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1202,6 +1202,7 @@ tests/python/Makefile
tests/simple/Makefile
tests/xml/Makefile
tests/xml/data/Makefile
+perf/Makefile
po/Makefile.in
gegl-uninstalled.pc
opencl/Makefile
diff --git a/gegl/buffer/gegl-sampler.c b/gegl/buffer/gegl-sampler.c
index ca39a87..da48688 100644
--- a/gegl/buffer/gegl-sampler.c
+++ b/gegl/buffer/gegl-sampler.c
@@ -142,7 +142,8 @@ gegl_sampler_prepare (GeglSampler *self)
if (klass->prepare)
klass->prepare (self);
- self->fish = babl_fish (self->interpolate_format, self->format);
+ if (!self->fish)
+ self->fish = babl_fish (self->interpolate_format, self->format);
/*
* This makes the cache rect invalid, in case the data in the buffer
diff --git a/perf/Makefile-retrospect b/perf/Makefile-retrospect
new file mode 100644
index 0000000..4da26af
--- /dev/null
+++ b/perf/Makefile-retrospect
@@ -0,0 +1,81 @@
+# A makefile based framework for testing performance commits in retrospect,
+# based on work done by pippin gimp org done for GEGL, original code placed in the public domain.
+
+SELF = Makefile-retrospect
+
+MAKE_FLAGS = -j3 -k
+CC = "ccache gcc" # if you do not have ccache replace with just gcc
+
+PROJECT_PATH = ../
+
+# mute makes echoing of commands
+#.SILENT:
+
+# replace sequential with random to build a random subset
+all: reset sequential
+#all: reset random
+
+retry:
+ rm -rf reports/`cat jobs | tail -n1`*
+ make -f $(SELF)
+
+prepare:
+ # uncomment these to make sure cpu is in high performance mode
+ #sudo sh -c 'echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor || true'
+ #sudo sh -c 'echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor || true'
+
+reset:
+ rm -rf jobs jobs
+ # remove checkout dir to have a full reset on each invokation
+ rm -rf checkout
+ # create clone
+ git clone -s $(PROJECT_PATH) checkout
+ mkdir reports > /dev/null 2>&1 || true
+ make -f $(SELF) jobs
+ make -f $(SELF) prepare
+
+jobs: joblist
+ ./makejobs.rb joblist > jobs
+
+sequential:
+ for a in `cat jobs`;do make -f $(SELF) reports/$$a;done
+
+random:
+ for a in `cat jobs|sort`;do make -f $(SELF) reports/$$a;done
+
+
+reports/%:
+ (cd checkout; git checkout `echo $@|sed s:reports/::`)
+ # write header for report
+ git log -1 `echo $@|sed s:reports/::` > $@ || true
+ # make sure revision is built, and current prefix symlink
+ ./perf-build.sh `echo $@|sed s:reports/::`
+ # run the Makefile for the tests
+ make -f Makefile-tests clean;\
+ make -f Makefile-tests; sync;\
+ make -f Makefile-tests check >> $@ || true
+ # update report.pdf / report.png
+ ./create-report.rb
+ echo
+
+rreports/%:
+ # check out revision
+ (cd checkout; git checkout `echo $@|sed s:reports/::`)
+ # write header for report
+ git log -1 `echo $@|sed s:reports/::` > $@ || true
+ # clean previous build
+ rm -rf prefix; mkdir prefixes; mkdir prefixes/`echo $@|sed s:reports/::`; ln -s prefixes/`echo $@|sed
s:reports/::` prefix
+ # build revision
+ (cd checkout; if [ ! -f Makefile ]; then CC=$(CC) ./autogen.sh --disable-introspection
--prefix=`pwd`/../prefix; fi ; \
+ make $(MAKE_FLAGS) ; make -k install ) > $ log 2>&1 || true
+ # testing
+ make -f Makefile-tests clean;\
+ make -f Makefile-tests; sync;\
+ make -f Makefile-tests check >> $@ || true
+ # update report.pdf / report.png
+ ./create-report.rb
+ echo
+
+clean:
+ rm -rf reports jobs report.pdf report.png checkout install
+ make -f Makefile-tests clean
diff --git a/perf/Makefile-tests b/perf/Makefile-tests
new file mode 100644
index 0000000..6bb3309
--- /dev/null
+++ b/perf/Makefile-tests
@@ -0,0 +1,15 @@
+CFILES = $(wildcard *.c)
+bins = $(subst ,,$(CFILES:.c=))
+
+all: $(bins)
+
+%: %.c
+ PKG_CONFIG_PATH=prefix/lib/pkgconfig:$(PKG_CONFIG_PATH) $(CC) -DTESTS_DATA_DIR=\"../data/\"
`pkg-config gegl-0.3 --cflags --libs` -Wall -O2 -o $@ $<
+
+check: $(bins)
+ for a in $(bins); do \
+ LD_LIBRARY_PATH=prefix/lib:$(LD_LIBRARY_PATH) ./$$a;\
+ done
+
+clean:
+ rm -f $(bins)
diff --git a/perf/Makefile.am b/perf/Makefile.am
new file mode 100644
index 0000000..7adc59f
--- /dev/null
+++ b/perf/Makefile.am
@@ -0,0 +1,47 @@
+
+noinst_PROGRAMS = \
+ test-blur \
+ test-bcontrast \
+ test-bcontrast-minichunk \
+ test-unsharpmask \
+ test-passthrough \
+ test-gegl-buffer-access \
+ test-rotate
+
+INCLUDES = \
+ -I$(top_srcdir)/ \
+ -I$(top_srcdir)/gegl/ \
+ -I$(top_srcdir)/gegl/buffer \
+ -I$(top_srcdir)/gegl/operation \
+ -I$(top_srcdir)/gegl/graph \
+ -I$(top_srcdir)/gegl/process \
+ -I$(top_srcdir)/gegl/property-types \
+ -I$(top_builddir)/gegl
+
+common_ldadd = $(top_builddir)/gegl/libgegl- GEGL_API_VERSION@.la
+
+LDADD = $(common_ldadd) $(DEP_LIBS) $(BABL_LIBS) -lm
+
+AM_CFLAGS = \
+ $(DEP_CFLAGS) $(BABL_CFLAGS)\
+ -DG_DISABLE_SINGLE_INCLUDES \
+ -DGLIB_DISABLE_DEPRECATION_WARNINGS \
+ -DCLUTTER_DISABLE_DEPRECATION_WARNINGS \
+ -DTESTS_DATA_DIR=\""$(top_srcdir)/tests/data/"\"
+
+perf-report: check
+
+check:
+ for a in $(noinst_PROGRAMS);do ./$$a;done;true
+
+test_rotate_SOURCES = test-rotate.c
+test_blur_SOURCES = test-blur.c
+test_bcontrast_SOURCES = test-bcontrast.c
+test_bcontrast_minichunk_SOURCES = test-bcontrast-minichunk.c
+test_passthrough_SOURCES = test-passthrough.c
+test_unsharpmask_SOURCES = test-unsharpmask.c
+test_gegl_buffer_access_SOURCES = test-gegl-buffer-access.c
+
+EXTRA_DIST = Makefile-retrospect Makefile-tests create-report.rb test-common.h
+
+
diff --git a/perf/create-report.rb b/perf/create-report.rb
index c014cfc..43defc4 100755
--- a/perf/create-report.rb
+++ b/perf/create-report.rb
@@ -1,5 +1,8 @@
#!/usr/bin/env ruby
#
+# ruby program to generate a performance report in PDF/png over git revisions, based on work
+# originally done for gegl by pippin gimp org, the original program is in the public domain.
+
require 'cairo'
def cairo_surface(w,h)
@@ -14,7 +17,6 @@ class Database
@vals = Hash.new
@runs = Array.new
@colors = [
- [0,0,1, 0.8],
[0,1,0, 0.8],
[0,1,1, 0.8],
[1,0,0, 0.8],
@@ -30,11 +32,12 @@ class Database
[1,1,0.5, 0.8],
[1,1,1, 0.8],
]
- @width = 1024
- @height = 300
+ @width = 1800
+ @height = 500
@marginlx = 10
- @marginrx = 140
+ @marginrx = 180
+ @rgap = 40
@marginy = 10
end
def val_max(key)
@@ -53,7 +56,7 @@ class Database
val = @vals[key][run]
min = val if val and val < min
}
- min
+ #min
0 # this shows the relative noise in measurements better
end
def add_run(run)
@@ -98,17 +101,17 @@ class Database
cr.move_to 1.0 * i / @runs.length * (@width - @marginlx- marginrx) + @marginlx, y
cr.set_source_rgba(0.6,0.6,0.6,1)
- cr.show_text(run[0..7])
+ cr.show_text(run[0..6])
i+=1
}
end
def draw_limits cr, key
- cr.move_to @width - @marginrx, 20
+ cr.move_to @width - @marginrx + @rgap, 20
cr.set_source_rgba(1.0, 1.0, 1.0, 1.0)
- cr.show_text(" #{val_max(key)} mb/s")
- cr.move_to @width - @marginrx, @height - @marginy
- cr.show_text(" #{val_min(key)} mb/s")
+ cr.show_text(" #{val_max(key)} ")
+ cr.move_to @width - @marginrx + @rgap, @height - @marginy
+ cr.show_text(" #{val_min(key)} ")
end
def draw_val cr, key, valno
@@ -116,7 +119,7 @@ class Database
max = val_max(key)
cr.set_source_rgba(@colors[valno])
- cr.move_to(@width - 137, valno * 14 + @marginy + 20)
+ cr.move_to(@width - @marginrx + @rgap, valno * 14 + @marginy + 20)
cr.show_text(key)
cr.line_width = 2
diff --git a/perf/joblist b/perf/joblist
new file mode 100644
index 0000000..f4d8947
--- /dev/null
+++ b/perf/joblist
@@ -0,0 +1,11 @@
+
+# 24ee45ef27f19971da390aa232e505bf6c72956d should be blacklisted
+
+#master~900..master % 16
+
+#ae81fbf..master
+#
+e4fd7c63e2b1bf19e6014bc64641828bbd478bc8..master % 128
+
+e012437..master % 4
+
diff --git a/perf/makejobs.rb b/perf/makejobs.rb
new file mode 100755
index 0000000..79499df
--- /dev/null
+++ b/perf/makejobs.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+# this ruby script generates a chronologically sorted
+
+res = ""
+input = File.read(ARGV[0])
+input = input.gsub(/#.*/, "")
+input.split("\n").each {|a|
+ if a =~ /([^ ]*)\.\.([^ ]*) %(.*)/
+ res += `git log #{$1}..#{$2} | grep '^commit' | sed 's/commit //' | sed -n '0~#{$3}p'`
+ elsif a =~ /([^ ]*)\.\.([^ ]*)/
+ res += `git log #{$1}..#{$2} | grep '^commit' | sed 's/commit //'`
+ else
+ res += `echo #{a}`
+ end
+}
+
+all = `git log | grep '^commit' | sed 's/commit//' `
+all.split("\n").reverse.each {|a|
+ if res.match(a.strip) != nil
+ puts "#{a.strip}"
+ end
+}
+
diff --git a/perf/tests/bcontrast-minichunk.c b/perf/test-bcontrast-minichunk.c
similarity index 100%
rename from perf/tests/bcontrast-minichunk.c
rename to perf/test-bcontrast-minichunk.c
diff --git a/perf/tests/bcontrast.c b/perf/test-bcontrast.c
similarity index 100%
rename from perf/tests/bcontrast.c
rename to perf/test-bcontrast.c
diff --git a/perf/tests/blur.c b/perf/test-blur.c
similarity index 100%
rename from perf/tests/blur.c
rename to perf/test-blur.c
diff --git a/perf/tests/test-common.h b/perf/test-common.h
similarity index 72%
rename from perf/tests/test-common.h
rename to perf/test-common.h
index 6d515a5..a26cb1d 100644
--- a/perf/tests/test-common.h
+++ b/perf/test-common.h
@@ -1,12 +1,18 @@
#include <stdlib.h>
#include <glib.h>
-#include <gegl.h>
+#include "gegl.h"
static long ticks_start;
long babl_ticks (void); /* using babl_ticks instead of gegl_ticks
to be able to go further back in time */
+void test_start (void);
+void test_end (const gchar *id,
+ glong bytes);
+GeglBuffer *test_buffer (gint width,
+ gint height,
+ const Babl *format);
void test_start (void)
{
ticks_start = babl_ticks ();
@@ -24,7 +30,7 @@ void test_end (const gchar *id,
*/
GeglBuffer *test_buffer (gint width,
gint height,
- Babl *format)
+ const Babl *format)
{
GeglRectangle bound = {0, 0, width, height};
GeglBuffer *buffer;
@@ -33,7 +39,7 @@ GeglBuffer *test_buffer (gint width,
buffer = gegl_buffer_new (&bound, format);
for (i=0; i < width * height * 4; i++)
buf[i] = g_random_double_range (-0.5, 2.0);
- gegl_buffer_set (buffer, NULL, babl_format ("RGBA float"), buf, 0);
+ gegl_buffer_set (buffer, NULL, 0, babl_format ("RGBA float"), buf, 0);
g_free (buf);
return buffer;
}
diff --git a/perf/tests/test-gegl-buffer-access.c b/perf/test-gegl-buffer-access.c
similarity index 63%
rename from perf/tests/test-gegl-buffer-access.c
rename to perf/test-gegl-buffer-access.c
index d2da382..63608ef 100644
--- a/perf/tests/test-gegl-buffer-access.c
+++ b/perf/test-gegl-buffer-access.c
@@ -5,7 +5,7 @@ main (gint argc,
gchar **argv)
{
GeglBuffer *buffer;
- GeglRectangle bound = {0, 0, 1024, 1024};
+ GeglRectangle bound = {0, 0, 4024, 4024};
gchar *buf;
gint i;
@@ -15,23 +15,27 @@ main (gint argc,
#define ITERATIONS 8
+ /* pre-initialize */
+ gegl_buffer_set (buffer, &bound, 0, NULL, buf, GEGL_AUTO_ROWSTRIDE);
+
+
test_start ();
for (i=0;i<ITERATIONS;i++)
{
- gegl_buffer_set (buffer, &bound, NULL, buf, GEGL_AUTO_ROWSTRIDE);
+ gegl_buffer_get (buffer, &bound, 1.0, NULL, buf, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
}
- test_end ("gegl_buffer_set", bound.width * bound.height * ITERATIONS * 16);
+ test_end ("gegl_buffer_get", bound.width * bound.height * ITERATIONS * 16);
test_start ();
for (i=0;i<ITERATIONS;i++)
{
- gegl_buffer_get (buffer, 1.0, &bound, NULL, buf, GEGL_AUTO_ROWSTRIDE);
+ gegl_buffer_set (buffer, &bound, 0, NULL, buf, GEGL_AUTO_ROWSTRIDE);
}
- test_end ("gegl_buffer_get", bound.width * bound.height * ITERATIONS * 16);
+ test_end ("gegl_buffer_set", bound.width * bound.height * ITERATIONS * 16);
g_free (buf);
- gegl_buffer_destroy (buffer);
+ g_object_unref (buffer);
return 0;
}
diff --git a/perf/tests/passthrough.c b/perf/test-passthrough.c
similarity index 100%
rename from perf/tests/passthrough.c
rename to perf/test-passthrough.c
diff --git a/perf/test-rotate.c b/perf/test-rotate.c
new file mode 100644
index 0000000..f7e4d69
--- /dev/null
+++ b/perf/test-rotate.c
@@ -0,0 +1,42 @@
+#include "test-common.h"
+
+gint
+main (gint argc,
+ gchar **argv)
+{
+ GeglBuffer *buffer, *buffer2;
+ GeglNode *gegl, *sink;
+
+ gegl_init (&argc, &argv);
+
+ buffer = test_buffer (1024, 1024, babl_format ("RGBA float"));
+
+ gegl = gegl_graph (sink = gegl_node ("gegl:buffer-sink", "buffer", &buffer2, NULL,
+ gegl_node ("gegl:rotate", "degrees", 4.0, NULL,
+ gegl_node ("gegl:buffer-source", "buffer", buffer, NULL))));
+
+ test_start ();
+ gegl_node_process (sink);
+ test_end ("rotate", gegl_buffer_get_pixel_count (buffer) * 16);
+
+ g_object_unref (gegl);
+
+ {
+ GeglBuffer *buffer, *buffer2;
+ GeglNode *gegl, *sink;
+
+ gegl_init (&argc, &argv);
+
+ buffer = test_buffer (1024, 1024, babl_format ("RGBA float"));
+
+ gegl = gegl_graph (sink = gegl_node ("gegl:buffer-sink", "buffer", &buffer2, NULL,
+ gegl_node ("gegl:rotate", "degrees", 4.0, "sampler", "nearest", NULL,
+ gegl_node ("gegl:buffer-source", "buffer", buffer, NULL))));
+
+ test_start ();
+ gegl_node_process (sink);
+ test_end ("rotate-nearest", gegl_buffer_get_pixel_count (buffer) * 16);
+ }
+
+ return 0;
+}
diff --git a/perf/tests/unsharpmask.c b/perf/test-unsharpmask.c
similarity index 100%
rename from perf/tests/unsharpmask.c
rename to perf/test-unsharpmask.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]