This commit is contained in:
John Cupitt 2010-04-29 07:50:27 +00:00
parent 26c495b938
commit ae2ef9c04e
2 changed files with 13 additions and 21 deletions

View File

@ -32,7 +32,7 @@
*/ */
/* /*
#define DEBUG #define VIPS_DEBUG
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -55,6 +55,7 @@
#include <vips/internal.h> #include <vips/internal.h>
#include <vips/thread.h> #include <vips/thread.h>
#include <vips/threadpool.h> #include <vips/threadpool.h>
#include <vips/debug.h>
#ifdef WITH_DMALLOC #ifdef WITH_DMALLOC
#include <dmalloc.h> #include <dmalloc.h>
@ -158,9 +159,7 @@ wbuffer_free( WriteBuffer *wbuffer )
/* Return value is always NULL (see wbuffer_write_thread). /* Return value is always NULL (see wbuffer_write_thread).
*/ */
(void) g_thread_join( wbuffer->thread ); (void) g_thread_join( wbuffer->thread );
#ifdef DEBUG VIPS_DEBUG_MSG( "wbuffer_free: g_thread_join()\n" );
printf( "wbuffer_free: g_thread_join()\n" );
#endif /*DEBUG*/
wbuffer->thread = NULL; wbuffer->thread = NULL;
} }
@ -177,12 +176,8 @@ wbuffer_write( WriteBuffer *wbuffer )
{ {
Write *write = wbuffer->write; Write *write = wbuffer->write;
#ifdef DEBUG VIPS_DEBUG_MSG( "wbuffer_write: %d bytes from wbuffer %p\n",
static int n = 1; wbuffer->region->bpl * wbuffer->area.height, wbuffer );
printf( "wbuffer_write: %d, %d bytes from wbuffer %p\n",
n++, wbuffer->region->bpl * wbuffer->area.height, wbuffer );
#endif /*DEBUG*/
wbuffer->write_errno = write->write_fn( wbuffer->region, wbuffer->write_errno = write->write_fn( wbuffer->region,
&wbuffer->area, write->a ); &wbuffer->area, write->a );
@ -265,11 +260,7 @@ wbuffer_flush( Write *write )
{ {
WriteBuffer *t; WriteBuffer *t;
#ifdef DEBUG VIPS_DEBUG_MSG( "wbuffer_flush:\n" );
static int n = 1;
printf( "wbuffer_flush: %d\n", n++ );
#endif /*DEBUG*/
/* Block until the other buffer has been written. We have to do this /* Block until the other buffer has been written. We have to do this
* before we can set this buffer writing or we'll lose output ordering. * before we can set this buffer writing or we'll lose output ordering.
@ -354,9 +345,7 @@ wbuffer_allocate_fn( VipsThreadState *state, void *a, gboolean *stop )
Rect image; Rect image;
Rect tile; Rect tile;
#ifdef DEBUG VIPS_DEBUG_MSG( "wbuffer_allocate_fn:\n" );
printf( "wbuffer_allocate_fn\n" );
#endif /*DEBUG*/
/* Is the state x/y OK? New line or maybe new buffer or maybe even /* Is the state x/y OK? New line or maybe new buffer or maybe even
* all done. * all done.
@ -417,9 +406,7 @@ wbuffer_work_fn( VipsThreadState *state, void *a )
{ {
WriteThreadState *wstate = (WriteThreadState *) state; WriteThreadState *wstate = (WriteThreadState *) state;
#ifdef DEBUG VIPS_DEBUG_MSG( "wbuffer_work_fn:\n" );
printf( "wbuffer_work_fn\n" );
#endif /*DEBUG*/
if( im_prepare_to( state->reg, wstate->buf->region, if( im_prepare_to( state->reg, wstate->buf->region,
&state->pos, state->pos.left, state->pos.top ) ) &state->pos, state->pos.left, state->pos.top ) )
@ -439,6 +426,9 @@ wbuffer_progress_fn( void *a )
{ {
Write *write = (Write *) a; Write *write = (Write *) a;
VIPS_DEBUG_MSG( "wbuffer_progress_fn: %d x %d\n",
write->tile_width, write->tile_height );
/* Trigger any eval callbacks on our source image and /* Trigger any eval callbacks on our source image and
* check for errors. * check for errors.
*/ */

View File

@ -809,6 +809,8 @@ vips_threadpool_run( VipsImage *im,
vips_thread_work_unit( pool->thr[0] ); vips_thread_work_unit( pool->thr[0] );
#endif /*HAVE_THREADS*/ #endif /*HAVE_THREADS*/
VIPS_DEBUG_MSG( "vips_threadpool_run: tick\n" );
if( pool->stop || pool->error ) if( pool->stop || pool->error )
break; break;