@@ -625,7 +625,9 @@ 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
630
+ attach_function :vips_concurrency_get , [ ] , :int
629
631
630
632
# vips_foreign_get_suffixes was added in libvips 8.8
631
633
begin
@@ -640,40 +642,113 @@ def self.leak_set leak
640
642
vips_leak_set ( ( leak ? 1 : 0 ) )
641
643
end
642
644
645
+ attach_function :vips_tracked_get_mem , [ ] , :int
646
+ attach_function :vips_tracked_get_mem_highwater , [ ] , :int
647
+ attach_function :vips_tracked_get_allocs , [ ] , :int
648
+ attach_function :vips_tracked_get_files , [ ] , :int
649
+ attach_function :vips_cache_get_max , [ ] , :int
650
+ attach_function :vips_cache_get_max_mem , [ ] , :int
651
+ attach_function :vips_cache_get_max_files , [ ] , :int
643
652
attach_function :vips_cache_set_max , [ :int ] , :void
644
653
attach_function :vips_cache_set_max_mem , [ :int ] , :void
645
654
attach_function :vips_cache_set_max_files , [ :int ] , :void
655
+ attach_function :vips_cache_print , [ ] , :void
656
+ attach_function :vips_cache_drop_all , [ ] , :void
657
+
658
+ # Get the number of bytes currently allocated via vips_malloc.
659
+ def self . tracked_mem
660
+ vips_tracked_get_mem
661
+ end
662
+
663
+ # Get the greatest number of bytes ever actively allocated via vips_malloc.
664
+ def self . tracked_mem_highwater
665
+ vips_tracked_get_mem_highwater
666
+ end
667
+
668
+ # Get the number of active allocations.
669
+ def self . tracked_allocs
670
+ vips_tracked_get_allocs
671
+ end
672
+
673
+ # Get the number of open files.
674
+ def self . tracked_files
675
+ vips_tracked_get_files
676
+ end
677
+
678
+ # Get the maximum number of operations that libvips should cache.
679
+ def self . cache_max
680
+ vips_cache_get_max
681
+ end
682
+
683
+ # Get the maximum amount of memory that libvips uses for the operation cache.
684
+ def self . cache_max_mem
685
+ vips_cache_get_max_mem
686
+ end
687
+
688
+ # Get the maximum number of files libvips keeps open in the operation cache.
689
+ def self . cache_max_files
690
+ vips_cache_get_max_files
691
+ end
646
692
647
693
# Set the maximum number of operations that libvips should cache. Set 0 to
648
694
# disable the operation cache. The default is 1000.
649
695
def self . cache_set_max size
650
696
vips_cache_set_max size
697
+ cache_max
651
698
end
652
699
653
700
# Set the maximum amount of memory that libvips should use for the operation
654
701
# cache. Set 0 to disable the operation cache. The default is 100mb.
655
702
def self . cache_set_max_mem size
656
703
vips_cache_set_max_mem size
704
+ cache_max_mem
657
705
end
658
706
659
707
# Set the maximum number of files libvips should keep open in the
660
708
# operation cache. Set 0 to disable the operation cache. The default is
661
709
# 100.
662
710
def self .
23D3
span>cache_set_max_files size
663
711
vips_cache_set_max_files size
712
+ cache_max_files
713
+ end
714
+
715
+ # Print the libvips operation cache to stdout. Handy for debugging.
716
+ def self . cache_print # :nodoc:
717
+ vips_cache_print
718
+ end
719
+
720
+ # Drop the libvips operation cache. Handy for leak tracking.
721
+ def self . cache_drop_all # :nodoc:
722
+ vips_cache_drop_all
723
+ end
724
+
725
+ # Get the size of the libvips worker pool. This defaults to the number of
726
+ # hardware threads on your computer.
727
+ def self . concurrency
728
+ vips_concurrency_get
664
729
end
665
730
666
731
# Set the size of the libvips worker pool. This defaults to the number of
667
732
# hardware threads on your computer. Set to 1 to disable threading.
733
+ # Set to 0 to use the default.
668
734
def self . concurrency_set n
669
735
vips_concurrency_set n
736
+ concurrency
737
+ end
738
+
739
+ # Whether SIMD and the run-time compiler are enabled. This can give a nice
740
+ # speed-up, but can also be unstable on some systems or with some versions
741
+ # of the run-time compiler.
742
+ def self . vector?
743
+ vips_vector_isenabled == 1
670
744
end
671
745
672
746
# Enable or disable SIMD and the run-time compiler. This can give a nice
673
747
# speed-up, but can also be unstable on some systems or with some versions
674
748
# of the run-time compiler.
675
749
def self . vector_set enabled
676
750
vips_vector_set_enabled ( enabled ? 1 : 0 )
751
+ vector?
677
752
end
678
753
679
754
# Deprecated compatibility function.
0 commit comments