"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libvips/iofuncs/gate.c" between
vips-8.10.6.tar.gz and vips-8.11.0.tar.gz

About: VIPS is a free image processing system (see also the GUI nip2).

gate.c  (vips-8.10.6):gate.c  (vips-8.11.0)
skipping to change at line 216 skipping to change at line 216
g_warning( "discarding unsaved state for thread %p --- " g_warning( "discarding unsaved state for thread %p --- "
"call vips_thread_shutdown() for this thread", "call vips_thread_shutdown() for this thread",
profile->thread ); profile->thread );
vips_thread_profile_free( profile ); vips_thread_profile_free( profile );
} }
static void * static void *
vips__thread_profile_init( void *data ) vips__thread_profile_init( void *data )
{ {
#ifdef HAVE_PRIVATE_INIT
static GPrivate private = static GPrivate private =
G_PRIVATE_INIT( (GDestroyNotify) vips__thread_profile_init_cb ); G_PRIVATE_INIT( (GDestroyNotify) vips__thread_profile_init_cb );
vips_thread_profile_key = &private; vips_thread_profile_key = &private;
#else
if( !vips_thread_profile_key )
vips_thread_profile_key = g_private_new(
(GDestroyNotify) vips__thread_profile_init_cb );
#endif
return( NULL ); return( NULL );
} }
static VipsThreadGate * static VipsThreadGate *
vips_thread_gate_new( const char *gate_name ) vips_thread_gate_new( const char *gate_name )
{ {
VipsThreadGate *gate; VipsThreadGate *gate;
gate = g_new( VipsThreadGate, 1 ); gate = g_new( VipsThreadGate, 1 );
skipping to change at line 254 skipping to change at line 248
vips__thread_profile_attach( const char *thread_name ) vips__thread_profile_attach( const char *thread_name )
{ {
static GOnce once = G_ONCE_INIT; static GOnce once = G_ONCE_INIT;
VipsThreadProfile *profile; VipsThreadProfile *profile;
VIPS_ONCE( &once, vips__thread_profile_init, NULL ); VIPS_ONCE( &once, vips__thread_profile_init, NULL );
VIPS_DEBUG_MSG( "vips__thread_profile_attach: %s\n", thread_name ); VIPS_DEBUG_MSG( "vips__thread_profile_attach: %s\n", thread_name );
g_assert( !g_private_get( vips_thread_profile_key ) );
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_direct_hash, g_str_equal, g_direct_hash, g_str_equal,
NULL, (GDestroyNotify) vips_thread_gate_free ); NULL, (GDestroyNotify) vips_thread_gate_free );
profile->memory = vips_thread_gate_new( "memory" ); profile->memory = vips_thread_gate_new( "memory" );
g_private_set( vips_thread_profile_key, profile ); g_private_replace( vips_thread_profile_key, profile );
} }
static VipsThreadProfile * static VipsThreadProfile *
vips_thread_profile_get( void ) vips_thread_profile_get( void )
{ {
return( g_private_get( vips_thread_profile_key ) ); return( g_private_get( vips_thread_profile_key ) );
} }
/* This usually happens automatically when a thread shuts down, see /* This usually happens automatically when a thread shuts down, see
* vips__thread_profile_init() where we set a GDestroyNotify, but will not * vips__thread_profile_init() where we set a GDestroyNotify, but will not
skipping to change at line 303 skipping to change at line 295
static void static void
vips_thread_gate_block_add( VipsThreadGateBlock **block ) vips_thread_gate_block_add( VipsThreadGateBlock **block )
{ {
VipsThreadGateBlock *new_block; VipsThreadGateBlock *new_block;
new_block = g_new0( VipsThreadGateBlock, 1 ); new_block = g_new0( VipsThreadGateBlock, 1 );
new_block->prev = *block; new_block->prev = *block;
*block = new_block; *block = new_block;
} }
static gint64
vips_get_time( void )
{
#ifdef HAVE_MONOTONIC_TIME
return( g_get_monotonic_time() );
#else
GTimeVal time;
g_get_current_time( &time );
return( (gint64) time.tv_usec );
#endif
}
void void
vips__thread_gate_start( const char *gate_name ) vips__thread_gate_start( const char *gate_name )
{ {
VipsThreadProfile *profile; VipsThreadProfile *profile;
VIPS_DEBUG_MSG_RED( "vips__thread_gate_start: %s\n", gate_name ); VIPS_DEBUG_MSG_RED( "vips__thread_gate_start: %s\n", gate_name );
if( (profile = vips_thread_profile_get()) ) { if( (profile = vips_thread_profile_get()) ) {
gint64 time = vips_get_time(); gint64 time = g_get_monotonic_time();
VipsThreadGate *gate; VipsThreadGate *gate;
if( !(gate = if( !(gate =
g_hash_table_lookup( profile->gates, gate_name )) ) { g_hash_table_lookup( profile->gates, gate_name )) ) {
gate = vips_thread_gate_new( gate_name ); gate = vips_thread_gate_new( gate_name );
g_hash_table_insert( profile->gates, g_hash_table_insert( profile->gates,
(char *) gate_name, gate ); (char *) gate_name, gate );
} }
skipping to change at line 353 skipping to change at line 331
} }
void void
vips__thread_gate_stop( const char *gate_name ) vips__thread_gate_stop( const char *gate_name )
{ {
VipsThreadProfile *profile; VipsThreadProfile *profile;
VIPS_DEBUG_MSG_RED( "vips__thread_gate_stop: %s\n", gate_name ); VIPS_DEBUG_MSG_RED( "vips__thread_gate_stop: %s\n", gate_name );
if( (profile = vips_thread_profile_get()) ) { if( (profile = vips_thread_profile_get()) ) {
gint64 time = vips_get_time(); gint64 time = g_get_monotonic_time();
VipsThreadGate *gate; VipsThreadGate *gate;
if( !(gate = if( !(gate =
g_hash_table_lookup( profile->gates, gate_name )) ) { g_hash_table_lookup( profile->gates, gate_name )) ) {
gate = vips_thread_gate_new( gate_name ); gate = vips_thread_gate_new( gate_name );
g_hash_table_insert( profile->gates, g_hash_table_insert( profile->gates,
(char *) gate_name, gate ); (char *) gate_name, gate );
} }
skipping to change at line 388 skipping to change at line 366
VipsThreadProfile *profile; VipsThreadProfile *profile;
VIPS_DEBUG_MSG_RED( "vips__thread_malloc_free: %zd\n", size ); VIPS_DEBUG_MSG_RED( "vips__thread_malloc_free: %zd\n", size );
#ifdef VIPS_DEBUG #ifdef VIPS_DEBUG
if( !(profile = vips_thread_profile_get()) ) if( !(profile = vips_thread_profile_get()) )
printf( "argh no block to record free() in!\n" ); printf( "argh no block to record free() in!\n" );
#endif /*VIPS_DEBUG*/ #endif /*VIPS_DEBUG*/
if( (profile = vips_thread_profile_get()) ) { if( (profile = vips_thread_profile_get()) ) {
gint64 time = vips_get_time(); gint64 time = g_get_monotonic_time();
VipsThreadGate *gate = profile->memory; VipsThreadGate *gate = profile->memory;
if( gate->start->i >= VIPS_GATE_SIZE ) { if( gate->start->i >= VIPS_GATE_SIZE ) {
vips_thread_gate_block_add( &gate->start ); vips_thread_gate_block_add( &gate->start );
vips_thread_gate_block_add( &gate->stop ); vips_thread_gate_block_add( &gate->stop );
} }
gate->start->time[gate->start->i++] = time; gate->start->time[gate->start->i++] = time;
gate->stop->time[gate->stop->i++] = size; gate->stop->time[gate->stop->i++] = size;
} }
 End of changes. 8 change blocks. 
26 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)