summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorFrederic Plourde <frederic.plourde@polymtl.ca>2008-07-17 13:56:22 -0700
committerVladimir Vukicevic <vladimir@sleet.vlad1.com>2008-07-17 13:56:22 -0700
commit5284f8cab488c12db0ff0b12a4485072138b8008 (patch)
tree4f05713fa29010e4bb357a6c447b5e8c796e4988 /perf
parentd61c7df1c0f9c69b0022c58efd001855551af7dd (diff)
[win32] Make cairo-perf-diff run on win32
Diffstat (limited to 'perf')
-rw-r--r--perf/Makefile.win324
-rw-r--r--perf/README21
-rwxr-xr-xperf/cairo-perf-diff6
-rw-r--r--perf/cairo-perf-diff-files.c56
4 files changed, 84 insertions, 3 deletions
diff --git a/perf/Makefile.win32 b/perf/Makefile.win32
index f1c86fea..37b51439 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 d41142a4..ca5f2a1c 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 3795456f..18aa4ddc 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 5fdf72d4..79d844c4 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)