aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-06-06 18:35:01 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-06-08 18:59:20 +0200
commit1e8fe1411b536d4c95c725209b0d817f25ba33f6 (patch)
tree31f376dab8ff6a5a715cd17c1f191bcefee5882a /tools
parent274c5f6f66c73a7b02ddd3d9b2297860212c154b (diff)
downloadfiv-1e8fe1411b536d4c95c725209b0d817f25ba33f6.tar.gz
fiv-1e8fe1411b536d4c95c725209b0d817f25ba33f6.tar.xz
fiv-1e8fe1411b536d4c95c725209b0d817f25ba33f6.zip
benchmark-io: ignore GdkPixbuf errors
Measuring up against that library is no longer that interesting.
Diffstat (limited to 'tools')
-rw-r--r--tools/benchmark-io.c23
1 files 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