summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-08-31 17:03:33 +0200
committerAndrea Canciani <ranma42@gmail.com>2011-09-02 12:45:49 +0200
commitdcd3e2cde13dcf56c3281911c98b2356b41ae877 (patch)
treeeb9647515cf00557ca8e7e15d1d48a0b937a8c3f /perf
parent9172e2aec0bfd7ac9ae464726bc79ace2d4d7113 (diff)
perf: Get rid of cairo_perf_ticks_per_second()
The cairo_time_from_s() and cairo_time_to_s() functions should be used instead.
Diffstat (limited to 'perf')
-rw-r--r--perf/cairo-perf-micro.c16
-rw-r--r--perf/cairo-perf-trace.c46
-rw-r--r--perf/cairo-perf.c6
-rw-r--r--perf/cairo-perf.h3
4 files changed, 31 insertions, 40 deletions
diff --git a/perf/cairo-perf-micro.c b/perf/cairo-perf-micro.c
index 959bfbc4..096986bc 100644
--- a/perf/cairo-perf-micro.c
+++ b/perf/cairo-perf-micro.c
@@ -135,7 +135,7 @@ cairo_perf_calibrate (cairo_perf_t *perf,
calibration = perf_func (perf->cr, perf->size, perf->size, min_loops);
if (!perf->fast_and_sloppy) {
- calibration_max = perf->ms_per_iteration * 0.0001 / 4 * cairo_perf_ticks_per_second ();
+ calibration_max = _cairo_time_from_s (perf->ms_per_iteration * 0.0001 / 4);
while (calibration < calibration_max) {
min_loops *= 2;
calibration = perf_func (perf->cr, perf->size, perf->size, min_loops);
@@ -153,7 +153,7 @@ cairo_perf_calibrate (cairo_perf_t *perf,
* a more rigorous analysis of the synchronisation overhead,
* that is to estimate the time for loop=0.
*/
- loops = perf->ms_per_iteration * 0.001 * cairo_perf_ticks_per_second () * min_loops / calibration;
+ loops = _cairo_time_from_s (perf->ms_per_iteration * 0.001 * min_loops / calibration);
min_loops = perf->fast_and_sloppy ? 1 : 10;
if (loops < min_loops)
loops = min_loops;
@@ -262,7 +262,7 @@ cairo_perf_run (cairo_perf_t *perf,
perf->target->name,
_content_to_string (perf->target->content, similar),
name, perf->size,
- cairo_perf_ticks_per_second () / 1000.0);
+ _cairo_time_to_double (_cairo_time_from_s (1.)) / 1000.);
printf (" %lld", (long long) times[i]);
} else if (! perf->exact_iterations) {
if (i > 0) {
@@ -289,16 +289,16 @@ cairo_perf_run (cairo_perf_t *perf,
fprintf (perf->summary,
"%10lld %#8.3f %#8.3f %#5.2f%% %3d: %.2f\n",
(long long) stats.min_ticks,
- (stats.min_ticks * 1000.0) / cairo_perf_ticks_per_second (),
- (stats.median_ticks * 1000.0) / cairo_perf_ticks_per_second (),
+ _cairo_time_to_s (stats.min_ticks) * 1000.0,
+ _cairo_time_to_s (stats.median_ticks) * 1000.0,
stats.std_dev * 100.0, stats.iterations,
- count * cairo_perf_ticks_per_second () / stats.min_ticks);
+ count / _cairo_time_to_s (stats.min_ticks));
} else {
fprintf (perf->summary,
"%10lld %#8.3f %#8.3f %#5.2f%% %3d\n",
(long long) stats.min_ticks,
- (stats.min_ticks * 1000.0) / cairo_perf_ticks_per_second (),
- (stats.median_ticks * 1000.0) / cairo_perf_ticks_per_second (),
+ _cairo_time_to_s (stats.min_ticks) * 1000.0,
+ _cairo_time_to_s (stats.median_ticks) * 1000.0,
stats.std_dev * 100.0, stats.iterations);
}
fflush (perf->summary);
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index d4ed30d6..3a9b8227 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -653,12 +653,12 @@ cairo_perf_trace (cairo_perf_t *perf,
if (perf->observe) {
cairo_device_t *observer = cairo_surface_get_device (args.surface);
- times[i] = cairo_device_observer_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
- paint[i] = cairo_device_observer_paint_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
- mask[i] = cairo_device_observer_mask_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
- stroke[i] = cairo_device_observer_stroke_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
- fill[i] = cairo_device_observer_fill_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
- glyphs[i] = cairo_device_observer_glyphs_elapsed (observer) * (1e-9 * cairo_perf_ticks_per_second ());
+ times[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_elapsed (observer));
+ paint[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_paint_elapsed (observer));
+ mask[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_mask_elapsed (observer));
+ stroke[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_stroke_elapsed (observer));
+ fill[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_fill_elapsed (observer));
+ glyphs[i] = _cairo_time_from_s (1.e9 * cairo_device_observer_glyphs_elapsed (observer));
} else {
clear_surface (args.surface); /* queue a write to the sync'ed surface */
cairo_perf_timer_stop ();
@@ -692,7 +692,7 @@ cairo_perf_trace (cairo_perf_t *perf,
"rgba",
name,
0,
- cairo_perf_ticks_per_second () / 1000.0);
+ _cairo_time_to_double (_cairo_time_from_s (1)) / 1000.);
printf (" %lld", (long long) times[i]);
fflush (stdout);
} else if (! perf->exact_iterations) {
@@ -718,35 +718,35 @@ cairo_perf_trace (cairo_perf_t *perf,
name);
if (perf->observe) {
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
_cairo_stats_compute (&stats, paint, i+1);
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
_cairo_stats_compute (&stats, mask, i+1);
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
_cairo_stats_compute (&stats, fill, i+1);
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
_cairo_stats_compute (&stats, stroke, i+1);
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
_cairo_stats_compute (&stats, glyphs, i+1);
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
fprintf (perf->summary,
" %5d", i+1);
} else {
fprintf (perf->summary,
"%#8.3f %#8.3f %#6.2f%% %4d/%d",
- (double) stats.min_ticks / cairo_perf_ticks_per_second (),
- (double) stats.median_ticks / cairo_perf_ticks_per_second (),
+ _cairo_time_to_s (stats.min_ticks),
+ _cairo_time_to_s (stats.median_ticks),
stats.std_dev * 100.0,
stats.iterations, i+1);
}
@@ -766,35 +766,35 @@ cairo_perf_trace (cairo_perf_t *perf,
}
if (perf->observe) {
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
_cairo_stats_compute (&stats, paint, i+1);
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
_cairo_stats_compute (&stats, mask, i+1);
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
_cairo_stats_compute (&stats, fill, i+1);
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
_cairo_stats_compute (&stats, stroke, i+1);
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
_cairo_stats_compute (&stats, glyphs, i+1);
fprintf (perf->summary,
- " %#9.3f", (double) stats.median_ticks / cairo_perf_ticks_per_second ());
+ " %#9.3f", _cairo_time_to_s (stats.median_ticks));
fprintf (perf->summary,
" %5d\n", i+1);
} else {
fprintf (perf->summary,
"%#8.3f %#8.3f %#6.2f%% %4d/%d\n",
- (double) stats.min_ticks / cairo_perf_ticks_per_second (),
- (double) stats.median_ticks / cairo_perf_ticks_per_second (),
+ _cairo_time_to_s (stats.min_ticks),
+ _cairo_time_to_s (stats.median_ticks),
stats.std_dev * 100.0,
stats.iterations, i);
}
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
index 1a60bdc4..7f2ff5b8 100644
--- a/perf/cairo-perf.c
+++ b/perf/cairo-perf.c
@@ -78,12 +78,6 @@ cairo_perf_timer_elapsed (void)
return timer;
}
-cairo_time_t
-cairo_perf_ticks_per_second (void)
-{
- return _cairo_time_from_s (1.);
-}
-
void
cairo_perf_yield (void)
{
diff --git a/perf/cairo-perf.h b/perf/cairo-perf.h
index 5facc8af..11c03f75 100644
--- a/perf/cairo-perf.h
+++ b/perf/cairo-perf.h
@@ -58,9 +58,6 @@ cairo_perf_timer_set_synchronize (cairo_perf_timer_synchronize_t synchronize,
cairo_time_t
cairo_perf_timer_elapsed (void);
-cairo_time_t
-cairo_perf_ticks_per_second (void);
-
/* yield */
void