@@ -625,6 +625,7 @@ def to_s
625
625
626
626
attach_function :vips_leak_set , [ :int ] , :void
627
627
attach_function :vips_vector_set_enabled , [ :int ] , :void
628
+ attach_function :vips_vector_isenabled , [ ] , :int
628
629
attach_function :vips_concurrency_set , [ :int ] , :void
629
630
630
631
# vips_foreign_get_suffixes was added in libvips 8.8
@@ -640,27 +641,84 @@ def self.leak_set leak
640
641
vips_leak_set ( ( leak ? 1 : 0 ) )
641
642
end
642
643
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
643
651
attach_function :vips_cache_set_max , [ :int ] , :void
644
652
attach_function :vips_cache_set_max_mem , [ :int ] , :void
645
653
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
646
691
647
692
# Set the maximum number of operations that libvips should cache. Set 0 to
648
693
# disable the operation cache. The default is 1000.
649
694
def self . cache_set_max size
650
695
vips_cache_set_max size
696
+ cache_max
651
697
end
652
698
653
699
# Set the maximum amount of memory that libvips should use for the operation
654
700
# cache. Set 0 to disable the operation cache. The default is 100mb.
655
701
def self . cache_set_max_mem size
656
702
vips_cache_set_max_mem size
703
+ cache_max_mem
657
704
end
658
705
659
706
# Set the maximum number of files libvips should keep open in the
660
707
# operation cache. Set 0 to disable the operation cache. The default is
661
708
# 100.
662
709
def self . cache_set_max_files size
663
710
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
664
722
end
665
723
666
724
# Set the size of the libvips worker pool. This defaults to the number of
@@ -669,11 +727,19 @@ def self.concurrency_set n
669
727
vips_concurrency_set n
670
728
end
671
729
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
+
672
737
# Enable or disable SIMD and the run-time compiler. This can give a nice
673
738
# speed-up, but can also be unstable on some systems or with some versions
674
739
# of the run-time compiler.
675
740
def self . vector_set enabled
676
741
vips_vector_set_enabled ( enabled ? 1 : 0 )
742
+ vector?
677
743
end
678
744
679
745
# Deprecated compatibility function.
0 commit comments