small polishes
This commit is contained in:
parent
0bf5ee12fd
commit
853124757b
@ -248,13 +248,11 @@ vips_colour_gen( VipsRegion *or,
|
|||||||
VipsRegion **ir = (VipsRegion **) seq;
|
VipsRegion **ir = (VipsRegion **) seq;
|
||||||
VipsColour *colour = VIPS_COLOUR( b );
|
VipsColour *colour = VIPS_COLOUR( b );
|
||||||
VipsColourClass *class = VIPS_COLOUR_GET_CLASS( colour );
|
VipsColourClass *class = VIPS_COLOUR_GET_CLASS( colour );
|
||||||
Rect *r = &or->valid;
|
VipsRect *r = &or->valid;
|
||||||
|
|
||||||
VipsPel *p[MAX_INPUT_IMAGES], *q;
|
|
||||||
int i, y;
|
int i, y;
|
||||||
|
VipsPel *p[MAX_INPUT_IMAGES], *q;
|
||||||
|
|
||||||
/* Prepare all input regions and make buffer pointers.
|
|
||||||
*/
|
|
||||||
for( i = 0; ir[i]; i++ )
|
for( i = 0; ir[i]; i++ )
|
||||||
if( vips_region_prepare( ir[i], r ) )
|
if( vips_region_prepare( ir[i], r ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
@ -191,7 +191,7 @@ vips__thread_profile_attach( const char *thread_name )
|
|||||||
profile = g_new( VipsThreadProfile, 1 );
|
profile = g_new( VipsThreadProfile, 1 );
|
||||||
profile->name = thread_name;
|
profile->name = thread_name;
|
||||||
profile->gates = g_hash_table_new_full(
|
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 );
|
NULL, (GDestroyNotify) vips_thread_gate_free );
|
||||||
g_private_set( vips_thread_profile_key, profile );
|
g_private_set( vips_thread_profile_key, profile );
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ vips__init( const char *argv0 )
|
|||||||
* happens, since vips__thread_profile may not be set yet. Call
|
* happens, since vips__thread_profile may not be set yet. Call
|
||||||
* directly.
|
* directly.
|
||||||
*/
|
*/
|
||||||
vips__thread_gate_start( "main" );
|
vips__thread_gate_start( "init: main" );
|
||||||
|
|
||||||
/* Try to discover our prefix.
|
/* Try to discover our prefix.
|
||||||
*/
|
*/
|
||||||
@ -382,13 +382,14 @@ vips_shutdown( void )
|
|||||||
|
|
||||||
im_close_plugins();
|
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;
|
static gboolean done = FALSE;
|
||||||
|
|
||||||
if( !done )
|
if( !done )
|
||||||
VIPS_GATE_STOP( "main" );
|
vips__thread_gate_stop( "init: main" );
|
||||||
}
|
}
|
||||||
|
|
||||||
vips__thread_profile_detach();
|
vips__thread_profile_detach();
|
||||||
|
@ -168,12 +168,12 @@ wbuffer_write( WriteBuffer *wbuffer )
|
|||||||
VIPS_DEBUG_MSG( "wbuffer_write: %d bytes from wbuffer %p\n",
|
VIPS_DEBUG_MSG( "wbuffer_write: %d bytes from wbuffer %p\n",
|
||||||
wbuffer->region->bpl * wbuffer->area.height, wbuffer );
|
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->write_errno = write->write_fn( wbuffer->region,
|
||||||
&wbuffer->area, write->a );
|
&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.
|
/* Run this as a thread to do a BG write.
|
||||||
|
@ -593,13 +593,15 @@ vips_thread_main_loop( void *a )
|
|||||||
|
|
||||||
g_assert( pool == thr->pool );
|
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
|
/* Process work units! Always tick, even if we are stopping, so the
|
||||||
* main thread will wake up for exit.
|
* main thread will wake up for exit.
|
||||||
*/
|
*/
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
VIPS_GATE_START( "vips_thread_work_unit: u" );
|
||||||
vips_thread_work_unit( thr );
|
vips_thread_work_unit( thr );
|
||||||
|
VIPS_GATE_STOP( "vips_thread_work_unit: u" );
|
||||||
vips_semaphore_up( &pool->tick );
|
vips_semaphore_up( &pool->tick );
|
||||||
|
|
||||||
if( pool->stop || pool->error )
|
if( pool->stop || pool->error )
|
||||||
@ -610,7 +612,7 @@ vips_thread_main_loop( void *a )
|
|||||||
*/
|
*/
|
||||||
vips_semaphore_up( &pool->finish );
|
vips_semaphore_up( &pool->finish );
|
||||||
|
|
||||||
VIPS_GATE_STOP( "vips_thread_main_loop:" );
|
VIPS_GATE_STOP( "vips_thread_main_loop: thread" );
|
||||||
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,9 @@ class Event:
|
|||||||
|
|
||||||
self.work = False
|
self.work = False
|
||||||
self.wait = False
|
self.wait = False
|
||||||
if re.match('.*?: .*work.*', gate_name):
|
if re.match('.*work.*', gate_name):
|
||||||
self.work = True
|
self.work = True
|
||||||
if re.match('.*?: .*wait.*', gate_name):
|
if re.match('.*wait.*', gate_name):
|
||||||
self.wait = True
|
self.wait = True
|
||||||
|
|
||||||
thread.events.append(self)
|
thread.events.append(self)
|
||||||
@ -79,6 +79,7 @@ with ReadFile(input_filename) as rf:
|
|||||||
match = re.match('thread: (.*)', rf.line)
|
match = re.match('thread: (.*)', rf.line)
|
||||||
if not match:
|
if not match:
|
||||||
print 'parse error line %d, expected "thread"' % rf.lineno
|
print 'parse error line %d, expected "thread"' % rf.lineno
|
||||||
|
print rf.line
|
||||||
thread_name = match.group(1) + " " + str(thread_id)
|
thread_name = match.group(1) + " " + str(thread_id)
|
||||||
thread_id += 1
|
thread_id += 1
|
||||||
thread = Thread(thread_name)
|
thread = Thread(thread_name)
|
||||||
@ -86,13 +87,10 @@ with ReadFile(input_filename) as rf:
|
|||||||
rf.getnext()
|
rf.getnext()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
match = re.match('gate: (.*)', rf.line)
|
match = re.match('gate: (.*?): (.*)', rf.line)
|
||||||
if not match:
|
if not match:
|
||||||
break
|
break
|
||||||
gate_name = match.group(1)
|
gate_name = match.group(2)
|
||||||
match = re.match('vips_(.*)', gate_name)
|
|
||||||
if match:
|
|
||||||
gate_name = match.group(1)
|
|
||||||
rf.getnext()
|
rf.getnext()
|
||||||
|
|
||||||
match = re.match('start:', rf.line)
|
match = re.match('start:', rf.line)
|
||||||
|
Loading…
Reference in New Issue
Block a user