1 /////////////////////////////////////////////////////////////////////////////// 2 // 3 /// \file hardware.h 4 /// \brief Detection of available hardware resources 5 // 6 // Author: Lasse Collin 7 // 8 // This file has been put into the public domain. 9 // You can do whatever you want with this file. 10 // 11 /////////////////////////////////////////////////////////////////////////////// 12 13 /// Initialize some hardware-specific variables, which are needed by other 14 /// hardware_* functions. 15 extern void hardware_init(void); 16 17 18 /// Set the maximum number of worker threads. 19 extern void hardware_threads_set(uint32_t threadlimit); 20 21 /// Get the maximum number of worker threads. 22 extern uint32_t hardware_threads_get(void); 23 24 25 /// Set the memory usage limit. There are separate limits for compression 26 /// and decompression (the latter includes also --list), one or both can 27 /// be set with a single call to this function. Zero indicates resetting 28 /// the limit back to the defaults. The limit can also be set as a percentage 29 /// of installed RAM; the percentage must be in the range [1, 100]. 30 extern void hardware_memlimit_set(uint64_t new_memlimit, 31 bool set_compress, bool set_decompress, bool is_percentage); 32 33 /// Get the current memory usage limit for compression or decompression. 34 extern uint64_t hardware_memlimit_get(enum operation_mode mode); 35 36 /// Display the amount of RAM and memory usage limits and exit. 37 extern void hardware_memlimit_show(void) lzma_attribute((__noreturn__)); 38