gegl r2705 - in trunk: . gegl/buffer
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2705 - in trunk: . gegl/buffer
- Date: Sat, 8 Nov 2008 22:49:48 +0000 (UTC)
Author: ok
Date: Sat Nov 8 22:49:48 2008
New Revision: 2705
URL: http://svn.gnome.org/viewvc/gegl?rev=2705&view=rev
Log:
* gegl/buffer/gegl-buffer-iterator.c: (gegl_buffer_iterator_next):
added instrumentation code (disabled by default) that counts how
many of the pixels ended up being accessed with direct memory access
in tiles, and how many are accessed through temporary buffers.
Modified:
trunk/ChangeLog
trunk/gegl/buffer/gegl-buffer-iterator.c
Modified: trunk/gegl/buffer/gegl-buffer-iterator.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-iterator.c (original)
+++ trunk/gegl/buffer/gegl-buffer-iterator.c Sat Nov 8 22:49:48 2008
@@ -57,6 +57,8 @@
#define GEGL_BUFFER_SCAN_COMPATIBLE 128 /* should be integrated into enum */
#define GEGL_BUFFER_FORMAT_COMPATIBLE 256 /* should be integrated into enum */
+#define DEBUG_DIRECT 0
+
typedef struct GeglBufferIterators
{
/* current region of interest */
@@ -229,6 +231,11 @@
return FALSE;
}
+static glong direct_read = 0;
+static glong direct_write = 0;
+static glong in_direct_read = 0;
+static glong in_direct_write = 0;
+
gint
gegl_buffer_iterator_add (GeglBufferIterator *iterator,
GeglBuffer *buffer,
@@ -311,9 +318,15 @@
i->roi[no].width == i->i[no].buffer->tile_storage->tile_width && (i->flags[no] & GEGL_BUFFER_FORMAT_COMPATIBLE))
{
/* direct access */
+#if DEBUG_DIRECT
+ direct_write += i->roi[no].width * i->roi[no].height;
+#endif
}
else
{
+#if DEBUG_DIRECT
+ in_direct_write += i->roi[no].width * i->roi[no].height;
+#endif
gegl_buffer_set (i->buffer[no], &(i->roi[no]), i->format[no], i->buf[no], GEGL_AUTO_ROWSTRIDE);
}
}
@@ -348,11 +361,17 @@
{
/* direct access */
i->data[no]=i->i[no].sub_data;
+#if DEBUG_DIRECT
+ direct_read += i->roi[no].width * i->roi[no].height;
+#endif
}
else
{
gegl_buffer_get (i->buffer[no], 1.0, &(i->roi[no]), i->format[no], i->buf[no], GEGL_AUTO_ROWSTRIDE);
i->data[no]=i->buf[no];
+#if DEBUG_DIRECT
+ in_direct_read += i->roi[no].width * i->roi[no].height;
+#endif
}
}
else
@@ -366,6 +385,10 @@
gegl_buffer_get (i->buffer[no], 1.0, &(i->roi[no]), i->format[no], i->buf[no], GEGL_AUTO_ROWSTRIDE);
i->data[no]=i->buf[no];
+
+#if DEBUG_DIRECT
+ in_direct_read += i->roi[no].width * i->roi[no].height;
+#endif
}
i->length = i->roi[no].width * i->roi[no].height;
}
@@ -381,6 +404,10 @@
i->buf[no]=NULL;
g_object_unref (i->buffer[no]);
}
+#if DEBUG_DIRECT
+ g_print ("%f %f\n", (100.0*direct_read/(in_direct_read+direct_read)),
+ 100.0*direct_write/(in_direct_write+direct_write));
+#endif
i->buf[0]=(void*)0xdeadbeef;
g_free (i);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]