@@ -625,6 +625,7 @@ def to_s
625625
626626 attach_function :vips_leak_set , [ :int ] , :void
627627 attach_function :vips_vector_set_enabled , [ :int ] , :void
628+ attach_function :vips_vector_isenabled , [ ] , :int
628629 attach_function :vips_concurrency_set , [ :int ] , :void
629630
630631 # vips_foreign_get_suffixes was added in libvips 8.8
@@ -640,27 +641,84 @@ def self.leak_set leak
640641 vips_leak_set ( ( leak ? 1 : 0 ) )
641642 end
642643
644+ attach_function :vips_tracked_get_mem , [ ] , :int
645+ attach_function :vips_tracked_get_mem_highwater , [ ] , :int
646+ attach_function :vips_tracked_get_allocs , [ ] , :int
647+ attach_function :vips_tracked_get_files , [ ] , :int
648+ attach_function :vips_cache_get_max , [ ] , :int
649+ attach_function :vips_cache_get_max_mem , [ ] , :int
650+ attach_function :vips_cache_get_max_files , [ ] , :int
643651 attach_function :vips_cache_set_max , [ :int ] , :void
644652 attach_function :vips_cache_set_max_mem , [ :int ] , :void
645653 attach_function :vips_cache_set_max_files , [ :int ] , :void
654+ attach_function :vips_cache_print , [ ] , :void
655+ attach_function :vips_cache_drop_all , [ ] , :void
656+
657+ # Get the number of bytes currently allocated via vips_malloc.
658+ def self . tracked_mem
659+ vips_tracked_get_mem
660+ end
661+
662+ # Get the greatest number of bytes ever actively allocated via vips_malloc.
663+ def self . tracked_mem_highwater
664+ vips_tracked_get_mem_highwater
665+ end
666+
667+ # Get the number of active allocations.
668+ def self . tracked_allocs
669+ vips_tracked_get_allocs
670+ end
671+
672+ # Get the number of open files.
673+ def self . tracked_files
674+ vips_tracked_get_files
675+ end
676+
677+ # Get the maximum number of operations that libvips should cache.
678+ def self . cache_max
679+ vips_cache_get_max
680+ end
681+
682+ # Get the maximum amount of memory that libvips uses for the operation cache.
683+ def self . cache_max_mem
684+ vips_cache_get_max_mem
685+ end
686+
687+ # Get the maximum number of files libvips keeps open in the operation cache.
688+ def self . cache_max_files
689+ vips_cache_get_max_files
690+ end
646691
647692 # Set the maximum number of operations that libvips should cache. Set 0 to
648693 # disable the operation cache. The default is 1000.
649694 def self . cache_set_max size
650695 vips_cache_set_max size
696+ cache_max
651697 end
652698
653699 # Set the maximum amount of memory that libvips should use for the operation
654700 # cache. Set 0 to disable the operation cache. The default is 100mb.
655701 def self . cache_set_max_mem size
656702 vips_cache_set_max_mem size
703+ cache_max_mem
657704 end
658705
659706 # Set the maximum number of files libvips should keep open in the
660707 # operation cache. Set 0 to disable the operation cache. The default is
661708 # 100.
662709 def self . cache_set_max_files size
663710 vips_cache_set_max_files size
711+ cache_max_files
712+ end
713+
714+ # Print the libvips operation cache to stdout. Handy for debugging.
715+ def self . cache_print # :nodoc:
716+ vips_cache_print
717+ end
718+
719+ # Drop the libvips operation cache. Handy for leak tracking.
720+ def self . cache_drop_all # :nodoc:
721+ vips_cache_drop_all
664722 end
665723
666724 # Set the size of the libvips worker pool. This defaults to the number of
@@ -669,11 +727,19 @@ def self.concurrency_set n
669727 vips_concurrency_set n
670728 end
671729
730+ # Whether SIMD and the run-time compiler are enabled. This can give a nice
731+ # speed-up, but can also be unstable on some systems or with some versions
732+ # of the run-time compiler.
733+ def self . vector?
734+ vips_vector_isenabled == 1
735+ end
736+
672737 # Enable or disable SIMD and the run-time compiler. This can give a nice
673738 # speed-up, but can also be unstable on some systems or with some versions
674739 # of the run-time compiler.
675740 def self . vector_set enabled
676741 vips_vector_set_enabled ( enabled ? 1 : 0 )
742+ vector?
677743 end
678744
679745 # Deprecated compatibility function.
0 commit comments