2007-12-08 17:42:33 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2009-02-05 02:12:57 -05:00
|
|
|
/// \file hardware.h
|
2007-12-08 17:42:33 -05:00
|
|
|
/// \brief Detection of available hardware resources
|
|
|
|
//
|
2009-04-13 04:27:40 -04:00
|
|
|
// Author: Lasse Collin
|
2007-12-08 17:42:33 -05:00
|
|
|
//
|
2009-04-13 04:27:40 -04:00
|
|
|
// This file has been put into the public domain.
|
|
|
|
// You can do whatever you want with this file.
|
2007-12-08 17:42:33 -05:00
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-11-19 13:46:52 -05:00
|
|
|
/// Initialize some hardware-specific variables, which are needed by other
|
|
|
|
/// hardware_* functions.
|
2007-12-08 17:42:33 -05:00
|
|
|
extern void hardware_init(void);
|
|
|
|
|
2008-11-19 13:46:52 -05:00
|
|
|
|
2011-04-09 08:11:13 -04:00
|
|
|
/// Set the maximum number of worker threads.
|
|
|
|
extern void hardware_threads_set(uint32_t threadlimit);
|
2009-02-13 17:45:29 -05:00
|
|
|
|
2011-04-09 08:11:13 -04:00
|
|
|
/// Get the maximum number of worker threads.
|
|
|
|
extern uint32_t hardware_threads_get(void);
|
2009-02-13 17:45:29 -05:00
|
|
|
|
2022-04-14 05:59:09 -04:00
|
|
|
/// Returns true if multithreaded mode should be used for .xz compression.
|
|
|
|
/// This can be true even if the number of threads is one.
|
|
|
|
extern bool hardware_threads_is_mt(void);
|
|
|
|
|
2009-02-13 17:45:29 -05:00
|
|
|
|
2022-04-11 15:20:49 -04:00
|
|
|
/// Set the memory usage limit. There are separate limits for compression,
|
|
|
|
/// decompression (also includes --list), and multithreaded decompression.
|
|
|
|
/// Any combination of these can be set with a single call to this function.
|
|
|
|
/// Zero indicates resetting the limit back to the defaults.
|
|
|
|
/// The limit can also be set as a percentage of installed RAM; the
|
|
|
|
/// percentage must be in the range [1, 100].
|
2010-08-07 13:45:18 -04:00
|
|
|
extern void hardware_memlimit_set(uint64_t new_memlimit,
|
2022-04-11 15:20:49 -04:00
|
|
|
bool set_compress, bool set_decompress, bool set_mtdec,
|
|
|
|
bool is_percentage);
|
2010-08-07 13:45:18 -04:00
|
|
|
|
|
|
|
/// Get the current memory usage limit for compression or decompression.
|
|
|
|
extern uint64_t hardware_memlimit_get(enum operation_mode mode);
|
|
|
|
|
2022-04-11 15:20:49 -04:00
|
|
|
/// Get the current memory usage limit for multithreaded decompression.
|
|
|
|
extern uint64_t hardware_memlimit_mtdec_get(void);
|
|
|
|
|
2010-08-07 13:45:18 -04:00
|
|
|
/// Display the amount of RAM and memory usage limits and exit.
|
2011-05-17 04:54:38 -04:00
|
|
|
extern void hardware_memlimit_show(void) lzma_attribute((__noreturn__));
|