summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-06-02 21:54:44 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-06-02 21:59:07 +0100
commitce7e6339428703069f798dffcf23ec3e98cb554f (patch)
treee2beeece345f98d34e49c26f09a690611d3aae48 /perf
parentf0366f0f3263397181699bf6bf2ed3968ea66403 (diff)
[perf] Warn if no traces were found
Diffstat (limited to 'perf')
-rw-r--r--perf/cairo-perf-trace.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index 898fed676..91eadaf04 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -432,6 +432,18 @@ cairo_perf_trace (cairo_perf_t *perf,
target->cleanup (closure);
}
+static void
+warn_no_traces (const char *message, const char *trace_dir)
+{
+ fprintf (stderr,
+"Error: %s '%s'.\n"
+"Have you cloned the cairo-traces repository and uncompressed the traces?\n"
+" git clone git://git.freedesktop.org/cairo-traces\n"
+" cd cairo-traces && make\n"
+"Or set the env.var CAIRO_TRACE_DIR to point to your traces?\n",
+ message, trace_dir);
+}
+
int
main (int argc, char *argv[])
{
@@ -484,17 +496,11 @@ main (int argc, char *argv[])
} else {
DIR *dir;
struct dirent *de;
+ int num_traces = 0;
dir = opendir (trace_dir);
if (dir == NULL) {
- fprintf (stderr,
-"Error: Failed to open trace directory '%s'.\n"
-"Have you cloned the trace repository?\n"
-" git clone git://git.freedesktop.org/cairo-traces\n"
-" cd cairo-traces && make\n"
-"Or set the env.var CAIRO_TRACE_DIR to point to your traces?\n",
- trace_dir);
-
+ warn_no_traces ("Failed to open directory", trace_dir);
return 1;
}
@@ -508,6 +514,7 @@ main (int argc, char *argv[])
if (strcmp (dot, ".trace"))
continue;
+ num_traces++;
if (! cairo_perf_can_run (&perf, de->d_name))
continue;
@@ -517,6 +524,11 @@ main (int argc, char *argv[])
}
closedir (dir);
+
+ if (num_traces == 0) {
+ warn_no_traces ("Found no traces in", trace_dir);
+ return 1;
+ }
}
if (perf.list_only)