summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-09-05 22:58:33 -0700
committerCarl Worth <cworth@cworth.org>2006-09-05 22:58:33 -0700
commit9d0d38e0a0307580ba69a96e239507cc9559cd99 (patch)
tree40cdcc22cb44d0c03745f6c179527dc88233479f
parent9f51fcc888c4b036c535a6a4042ae8c6859f3261 (diff)
perf: Rename functions in line with cairo's naming guidelines
-rw-r--r--perf/cairo-perf-posix.c24
-rw-r--r--perf/cairo-perf-win32.c20
-rw-r--r--perf/cairo-perf.c2
-rw-r--r--perf/cairo-perf.h10
-rw-r--r--perf/paint.c6
5 files changed, 30 insertions, 32 deletions
diff --git a/perf/cairo-perf-posix.c b/perf/cairo-perf-posix.c
index 685d7e5a..e710d52c 100644
--- a/perf/cairo-perf-posix.c
+++ b/perf/cairo-perf-posix.c
@@ -36,30 +36,30 @@
/* timers */
-static cairo_perf_timer_t tr;
-
-struct _cairo_perf_timer_t
+typedef struct _cairo_perf_timer
{
struct timeval start;
struct timeval stop;
-};
+} cairo_perf_timer_t;
+
+static cairo_perf_timer_t timer;
void
-timer_start (void) {
- gettimeofday (&tr.start, NULL);
+cairo_perf_timer_start (void) {
+ gettimeofday (&timer.start, NULL);
}
void
-timer_stop (void) {
- gettimeofday (&tr.stop, NULL);
+cairo_perf_timer_stop (void) {
+ gettimeofday (&timer.stop, NULL);
}
double
-timer_elapsed (void) {
+cairo_perf_timer_elapsed (void) {
double d;
- d = tr.stop.tv_sec - tr.start.tv_sec;
- d += (tr.stop.tv_usec - tr.start.tv_usec) / 1000000.0;
+ d = timer.stop.tv_sec - timer.start.tv_sec;
+ d += (timer.stop.tv_usec - timer.start.tv_usec) / 1000000.0;
return d;
}
@@ -67,7 +67,7 @@ timer_elapsed (void) {
/* yield */
void
-yield (void) {
+cairo_perf_yield (void) {
#ifdef _POSIX_PRIORITY_SCHEDULING
sched_yield ();
#endif
diff --git a/perf/cairo-perf-win32.c b/perf/cairo-perf-win32.c
index f0caa73a..22cea626 100644
--- a/perf/cairo-perf-win32.c
+++ b/perf/cairo-perf-win32.c
@@ -34,38 +34,38 @@
/* timers */
-struct _cairo_perf_timer_t
+typedef struct _cairo_perf_timer
{
LARGE_INTEGER start;
LARGE_INTEGER stop;
-};
+} cairo_perf_timer_t;
-static cairo_perf_timer_t tr;
+static cairo_perf_timer_t timer;
void
-timer_start (void) {
- QueryPerformanceCounter(&tr.start);
+cairo_perf_timer_start (void) {
+ QueryPerformanceCounter(&timer.start);
}
void
-timer_stop (void) {
- QueryPerformanceCounter(&tr.stop);
+cairo_perf_timer_stop (void) {
+ QueryPerformanceCounter(&timer.stop);
}
double
-timer_elapsed (void) {
+cairo_perf_timer_elapsed (void) {
double d;
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
- d = (tr.stop.QuadPart - tr.start.QuadPart) / (double) freq.QuadPart;
+ d = (timer.stop.QuadPart - timer.start.QuadPart) / (double) freq.QuadPart;
return d;
}
/* yield */
void
-yield (void) {
+cairo_perf_yield (void) {
SleepEx(0, TRUE);
}
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
index 9e51791d..c146d705 100644
--- a/perf/cairo-perf.c
+++ b/perf/cairo-perf.c
@@ -165,7 +165,7 @@ main (int argc, char *argv[])
&target->closure);
cr = cairo_create (surface);
for (k =0; k < cairo_perf_iterations; k++) {
- yield ();
+ cairo_perf_yield ();
rates[k] = perf->run (cr, size, size);
}
_compute_stats (rates, cairo_perf_iterations, &stats);
diff --git a/perf/cairo-perf.h b/perf/cairo-perf.h
index 34d2bbd0..d4f049ec 100644
--- a/perf/cairo-perf.h
+++ b/perf/cairo-perf.h
@@ -30,23 +30,21 @@
#include "cairo-boilerplate.h"
-typedef struct _cairo_perf_timer_t cairo_perf_timer_t;
-
/* timers */
void
-timer_start (void);
+cairo_perf_timer_start (void);
void
-timer_stop (void);
+cairo_perf_timer_stop (void);
double
-timer_elapsed (void);
+cairo_perf_timer_elapsed (void);
/* yield */
void
-yield (void);
+cairo_perf_yield (void);
typedef double (*cairo_perf_func_t) (cairo_t *cr, int width, int height);
diff --git a/perf/paint.c b/perf/paint.c
index 858f15dd..b2f36b40 100644
--- a/perf/paint.c
+++ b/perf/paint.c
@@ -30,14 +30,14 @@ do_paint (cairo_t *cr)
{
int i;
- timer_start ();
+ cairo_perf_timer_start ();
for (i=0; i < 3; i++)
cairo_paint (cr);
- timer_stop ();
+ cairo_perf_timer_stop ();
- return 1.0 / timer_elapsed ();
+ return 1.0 / cairo_perf_timer_elapsed ();
}
double