[cairo] at last -> a new Win32-enabled Cairo-Perf-Diff !
Frederic Plourde
frederic.plourde at polymtl.ca
Fri Apr 11 12:27:59 PDT 2008
Hi everybody,
Since my first day working on cairo and pixman, I've been using manual perf
comparisons (using excel *sigh* !!) of cairo-perf outputs because
cairo-perf-diff, well, just wouldn't build nor run under Windows...
I believe I was loosing too much time by manual converting outputs from
perf-diff format to excel format everytime, so here a patch that fixes
cairo-perf-diff compilation and execution under Win32 plateform.
It's been tested under Windows, of course, but also under Linux... and as
expected, it didn't change cairo-perf-diff behaviour under linux.
I'd be very happy if anybody could apply this patch under Linux and Mac OS to
see if cairo-perf-diff is still building and running smoothly under those
plateforms
Thanx a lot ! ;-)
Best,
Fred_the_win32_guy.
diff --git a/perf/Makefile.win32 b/perf/Makefile.win32
index f1c86fe..37b5143 100644
--- a/perf/Makefile.win32
+++ b/perf/Makefile.win32
@@ -41,6 +41,10 @@ $(CFG)/cairo-perf.exe: $(OBJECTS)
@mkdir -p $(CFG)
@$(CC) $(CFLAGS) -Fe"$@" $^ -link $(LDFLAGS)
+cairo-perf-diff-files:
+ @mkdir -p $(CFG)
+ @$(CC) $(CFLAGS) -Fe"$@" cairo-perf-diff-files.c cairo-stats.c -link
$(LDFLAGS)
+
clean:
@rm -f $(CFG)/*.obj $(CFG)/*.exe $(CFG)/*.dll $(CFG)/*.lib $(CFG)/*.pdb
$(CFG)/*.ilk || exit 0
diff --git a/perf/README b/perf/README
index d41142a..f9db06c 100644
--- a/perf/README
+++ b/perf/README
@@ -179,4 +179,25 @@ added:
above, three tests would be performed at sizes of 16x16, 32x32 and
64x64.
+How to run cairo-perf-diff on WINDOWS
+-------------------------------------
+This section explains the specifics of running cairo-perf-diff under
+win32 plateforms. It assumes that you have installed a UNIX-like shell
+environment such as MSYS (distributed as part of MinGW).
+
+ 1. From your Mingw32 window, be sure to have all of your MSVC environ-
+ ment variables set up for proper compilation using 'make'
+
+ 2. Add the %GitBaseDir%/Git/bin path to your environment, replacing the
+ %GitBaseDir% by whatever directory your Git version is installed to.
+
+ 3. Comment out the "UNSET CDPATH" line in the git-sh-setup script
+ (located inside the ...Git/bin directory) by putting a "#" at the
+ beginning of the line.
+
+you should be ready to go !
+
+From your mingw32 window, go to your cairo/perf directory and run the
+cairo-perf-diff script with the right arguments.
+
Thanks for your contributions and have fun with cairo!
diff --git a/perf/cairo-perf-diff b/perf/cairo-perf-diff
index 3795456..18aa4dd 100755
--- a/perf/cairo-perf-diff
+++ b/perf/cairo-perf-diff
@@ -189,7 +189,11 @@ git_setup
# Build cairo-perf-diff-files if not available
if [ ! -e $CAIRO_DIR/perf/cairo-perf-diff-files ]; then
echo "Building cairo-perf-diff-files"
- make -C $CAIRO_DIR/perf/ cairo-perf-diff-files
+ if [ $OS = "Windows_NT" ]; then
+ make -f Makefile.win32 -C $CAIRO_DIR/perf/ cairo-perf-diff-files
CFG=debug
+ else
+ make -C $CAIRO_DIR/perf/ cairo-perf-diff-files
+ fi
fi
if [ ! -e $old ]; then
diff --git a/perf/cairo-perf-diff-files.c b/perf/cairo-perf-diff-files.c
index 5fdf72d..79d844c 100644
--- a/perf/cairo-perf-diff-files.c
+++ b/perf/cairo-perf-diff-files.c
@@ -96,6 +96,12 @@ typedef struct _cairo_perf_diff_files_args {
cairo_perf_report_options_t options;
} cairo_perf_diff_files_args_t;
+/* 'ssize_t' does not exist in the C standard on win32.
+ * We use 'ptrdiff_t', which is nearly equivalent. */
+#ifdef _MSC_VER
+typedef ptrdiff_t ssize_t;
+#endif
+
#ifndef __USE_GNU
static ssize_t
getline (char **lineptr, size_t *n, FILE *stream);
@@ -104,6 +110,14 @@ static char *
strndup (const char *s, size_t n);
#endif
+#ifdef _MSC_VER
+static long long
+strtoll(const char *nptr, char **endptr, int base);
+
+static char *
+basename(char *path);
+#endif
+
/* Ad-hoc parsing, macros with a strong dependence on the calling
* context, and plenty of other ugliness is here. But at least it's
* not perl... */
@@ -304,6 +318,40 @@ strndup (const char *s, size_t n)
}
#endif /* ifndef __USE_GNU */
+/* We provide hereafter a win32 implementation of the basename
+ * and strtoll functions which are not available otherwise.
+ * The basename function is fully compliant to its GNU specs.
+ */
+#ifdef _MSC_VER
+long long
+strtoll(const char *nptr, char **endptr, int base)
+{
+ return _atoi64(nptr);
+}
+
+static char *
+basename(char *path)
+{
+ char *end, *s;
+
+ end = (path + strlen(path) - 1);
+ while (end && (end >= path + 1) && (*end == '/')) {
+ *end = '\0';
+ end--;
+ }
+
+ s = strrchr(path, '/');
+ if (s) {
+ if (s == end) {
+ return s;
+ } else {
+ return s+1;
+ }
+ } else {
+ return path;
+ }
+}
+#endif /* ifndef _MSC_VER */
static int
test_report_cmp_backend_then_name (const void *a, const void *b)
@@ -397,9 +445,13 @@ cairo_perf_report_load (cairo_perf_report_t *report, const
char *filename)
size_t line_size = 0;
char *configuration;
char *dot;
+ char *baseName;
- configuration = strdup (filename);
- report->configuration = strdup (basename (configuration));
+ configuration = xmalloc (strlen (filename) * sizeof (char) + 1);
+ strcpy (configuration, filename);
+ baseName = strdup (basename (configuration));
+ report->configuration = xmalloc (strlen (filename) * sizeof (char) + 1);
+ strcpy(report->configuration, baseName);
free (configuration);
dot = strrchr (report->configuration, '.');
if (dot)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo_PERF-DIFF_fixed_on_win32.patch
Type: application/octet-stream
Size: 4719 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080411/47d01298/attachment.obj
More information about the cairo
mailing list