From 1e8fe1411b536d4c95c725209b0d817f25ba33f6 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Tue, 6 Jun 2023 18:35:01 +0200 Subject: benchmark-io: ignore GdkPixbuf errors Measuring up against that library is no longer that interesting. --- tools/benchmark-io.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tools/benchmark-io.c b/tools/benchmark-io.c index 4275ceb..3acb140 100644 --- a/tools/benchmark-io.c +++ b/tools/benchmark-io.c @@ -33,7 +33,7 @@ static void one_file(const char *filename) { GFile *file = g_file_new_for_commandline_arg(filename); - double since_us = timestamp(); + double since_us = timestamp(), us = 0; FivIoOpenContext ctx = { .uri = g_file_get_uri(file), .screen_dpi = 96, @@ -49,20 +49,19 @@ one_file(const char *filename) return; cairo_surface_destroy(loaded_by_us); - double us = timestamp() - since_us; + us = timestamp() - since_us; - double since_pixbuf = timestamp(); + double since_pixbuf = timestamp(), pixbuf = 0; GdkPixbuf *gdk_pixbuf = gdk_pixbuf_new_from_file(filename, NULL); - if (!gdk_pixbuf) - return; - - cairo_surface_t *loaded_by_pixbuf = - gdk_cairo_surface_create_from_pixbuf(gdk_pixbuf, 1, NULL); - g_object_unref(gdk_pixbuf); - cairo_surface_destroy(loaded_by_pixbuf); - double pixbuf = timestamp() - since_pixbuf; + if (gdk_pixbuf) { + cairo_surface_t *loaded_by_pixbuf = + gdk_cairo_surface_create_from_pixbuf(gdk_pixbuf, 1, NULL); + g_object_unref(gdk_pixbuf); + cairo_surface_destroy(loaded_by_pixbuf); + pixbuf = timestamp() - since_pixbuf; + } - printf("%f\t%f\t%.0f%%\t%s\n", us, pixbuf, us / pixbuf * 100, filename); + printf("%.3f\t%.3f\t%.0f%%\t%s\n", us, pixbuf, us / pixbuf * 100, filename); } int -- cgit v1.2.3-70-g09d2