improve cache trace output

now shows '*' for cache hit, lists output args as well
This commit is contained in:
John Cupitt 2015-04-13 12:08:42 +01:00
parent d8018e8126
commit 951019fcbc
2 changed files with 11 additions and 8 deletions

View File

@ -757,7 +757,7 @@ vips_cache_operation_lookup( VipsOperation *operation )
if( (hit = g_hash_table_lookup( vips_cache_table, operation )) ) {
if( vips__cache_trace ) {
printf( "vips cache-: " );
printf( "vips cache*: " );
vips_object_print_summary( VIPS_OBJECT( operation ) );
}
@ -788,19 +788,21 @@ vips_cache_operation_add( VipsOperation *operation )
* https://github.com/jcupitt/libvips/pull/181
*/
if( !g_hash_table_lookup( vips_cache_table, operation ) ) {
VipsOperationFlags flags =
vips_operation_get_flags( operation );
gboolean nocache = flags & VIPS_OPERATION_NOCACHE;
/* Has to be after _build() so we can see output args.
*/
if( vips__cache_trace ) {
if( vips_operation_get_flags( operation ) &
VIPS_OPERATION_NOCACHE )
if( nocache )
printf( "vips cache : " );
else
printf( "vips cache+: " );
vips_object_print_summary( VIPS_OBJECT( operation ) );
}
if( !(vips_operation_get_flags( operation ) &
VIPS_OPERATION_NOCACHE) )
if( !nocache )
vips_cache_insert( operation );
}
@ -843,7 +845,6 @@ vips_cache_operation_buildp( VipsOperation **operation )
vips_cache_operation_add( *operation );
}
return( 0 );
}

View File

@ -504,9 +504,11 @@ vips_operation_vips_operation_print_summary_arg( VipsObject *object,
{
VipsBuf *buf = (VipsBuf *) a;
/* Just assigned input construct args
/* Just assigned input and output construct args. _summary() is used
* for things like cache tracing, so it's useful to show output args.
*/
if( (argument_class->flags & VIPS_ARGUMENT_INPUT) &&
if( ((argument_class->flags & VIPS_ARGUMENT_INPUT) ||
(argument_class->flags & VIPS_ARGUMENT_OUTPUT)) &&
(argument_class->flags & VIPS_ARGUMENT_CONSTRUCT) &&
argument_instance->assigned ) {
const char *name = g_param_spec_get_name( pspec );