small polishes

This commit is contained in:
John Cupitt 2013-11-27 17:31:07 +00:00
parent 0bf5ee12fd
commit 853124757b
6 changed files with 18 additions and 19 deletions

View File

@ -248,13 +248,11 @@ vips_colour_gen( VipsRegion *or,
VipsRegion **ir = (VipsRegion **) seq;
VipsColour *colour = VIPS_COLOUR( b );
VipsColourClass *class = VIPS_COLOUR_GET_CLASS( colour );
Rect *r = &or->valid;
VipsRect *r = &or->valid;
VipsPel *p[MAX_INPUT_IMAGES], *q;
int i, y;
VipsPel *p[MAX_INPUT_IMAGES], *q;
/* Prepare all input regions and make buffer pointers.
*/
for( i = 0; ir[i]; i++ )
if( vips_region_prepare( ir[i], r ) )
return( -1 );

View File

@ -191,7 +191,7 @@ vips__thread_profile_attach( const char *thread_name )
profile = g_new( VipsThreadProfile, 1 );
profile->name = thread_name;
profile->gates = g_hash_table_new_full(
g_str_hash, g_str_equal,
g_direct_hash, g_str_equal,
NULL, (GDestroyNotify) vips_thread_gate_free );
g_private_set( vips_thread_profile_key, profile );
}

View File

@ -225,7 +225,7 @@ vips__init( const char *argv0 )
* happens, since vips__thread_profile may not be set yet. Call
* directly.
*/
vips__thread_gate_start( "main" );
vips__thread_gate_start( "init: main" );
/* Try to discover our prefix.
*/
@ -382,13 +382,14 @@ vips_shutdown( void )
im_close_plugins();
/* Mustn't run this more than once.
/* Mustn't run this more than once. Don't use the VIPS_GATE macro,
* since we don't for gate start.
*/
{
static gboolean done = FALSE;
if( !done )
VIPS_GATE_STOP( "main" );
vips__thread_gate_stop( "init: main" );
}
vips__thread_profile_detach();

View File

@ -168,12 +168,12 @@ wbuffer_write( WriteBuffer *wbuffer )
VIPS_DEBUG_MSG( "wbuffer_write: %d bytes from wbuffer %p\n",
wbuffer->region->bpl * wbuffer->area.height, wbuffer );
VIPS_GATE_START( "wbuffer_write: " );
VIPS_GATE_START( "wbuffer_write: work" );
wbuffer->write_errno = write->write_fn( wbuffer->region,
&wbuffer->area, write->a );
VIPS_GATE_STOP( "wbuffer_write: " );
VIPS_GATE_STOP( "wbuffer_write: work" );
}
/* Run this as a thread to do a BG write.

View File

@ -593,13 +593,15 @@ vips_thread_main_loop( void *a )
g_assert( pool == thr->pool );
VIPS_GATE_START( "vips_thread_main_loop:" );
VIPS_GATE_START( "vips_thread_main_loop: thread" );
/* Process work units! Always tick, even if we are stopping, so the
* main thread will wake up for exit.
*/
for(;;) {
VIPS_GATE_START( "vips_thread_work_unit: u" );
vips_thread_work_unit( thr );
VIPS_GATE_STOP( "vips_thread_work_unit: u" );
vips_semaphore_up( &pool->tick );
if( pool->stop || pool->error )
@ -610,7 +612,7 @@ vips_thread_main_loop( void *a )
*/
vips_semaphore_up( &pool->finish );
VIPS_GATE_STOP( "vips_thread_main_loop:" );
VIPS_GATE_STOP( "vips_thread_main_loop: thread" );
return( NULL );
}

View File

@ -54,9 +54,9 @@ class Event:
self.work = False
self.wait = False
if re.match('.*?: .*work.*', gate_name):
if re.match('.*work.*', gate_name):
self.work = True
if re.match('.*?: .*wait.*', gate_name):
if re.match('.*wait.*', gate_name):
self.wait = True
thread.events.append(self)
@ -79,6 +79,7 @@ with ReadFile(input_filename) as rf:
match = re.match('thread: (.*)', rf.line)
if not match:
print 'parse error line %d, expected "thread"' % rf.lineno
print rf.line
thread_name = match.group(1) + " " + str(thread_id)
thread_id += 1
thread = Thread(thread_name)
@ -86,13 +87,10 @@ with ReadFile(input_filename) as rf:
rf.getnext()
while True:
match = re.match('gate: (.*)', rf.line)
match = re.match('gate: (.*?): (.*)', rf.line)
if not match:
break
gate_name = match.group(1)
match = re.match('vips_(.*)', gate_name)
if match:
gate_name = match.group(1)
gate_name = match.group(2)
rf.getnext()
match = re.match('start:', rf.line)