Detection of available hardware resources. More...
#include "private.h"
#include "tuklib_cpucores.h"
Functions | |
void | hardware_threadlimit_set (uint32_t new_threadlimit) |
Set custom value for maximum number of coder threads. | |
uint32_t | hardware_threadlimit_get (void) |
void | hardware_memlimit_set (uint64_t new_memlimit, bool set_compress, bool set_decompress, bool is_percentage) |
uint64_t | hardware_memlimit_get (enum operation_mode mode) |
Get the current memory usage limit for compression or decompression. | |
static void | memlimit_show (const char *str, uint64_t value) |
Helper for hardware_memlimit_show() to print one human-readable info line. | |
void | hardware_memlimit_show (void) |
Display the amount of RAM and memory usage limits and exit. | |
void | hardware_init (void) |
Variables | |
static uint32_t | threadlimit |
static uint64_t | memlimit_compress |
Memory usage limit for compression. | |
static uint64_t | memlimit_decompress |
Memory usage limit for decompression. | |
static uint64_t | total_ram |
Total amount of physical RAM. |
Detection of available hardware resources.
void hardware_threadlimit_set | ( | uint32_t | new_threadlimit | ) |
Set custom value for maximum number of coder threads.
References threadlimit.
Referenced by hardware_init().
uint32_t hardware_threadlimit_get | ( | void | ) |
Get the maximum number of coder threads. Some additional helper threads are allowed on top of this).
References threadlimit.
void hardware_memlimit_set | ( | uint64_t | new_memlimit, | |
bool | set_compress, | |||
bool | set_decompress, | |||
bool | is_percentage | |||
) |
Set the memory usage limit. There are separate limits for compression and decompression (the latter includes also --list), one or both 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].
References memlimit_compress, memlimit_decompress, and total_ram.
Referenced by hardware_init(), and parse_memlimit().
uint64_t hardware_memlimit_get | ( | enum operation_mode | mode | ) |
Get the current memory usage limit for compression or decompression.
References memlimit_compress, and memlimit_decompress.
Referenced by coder_init(), message_mem_needed(), and parse_indexes().
static void memlimit_show | ( | const char * | str, | |
uint64_t | value | |||
) | [static] |
Helper for hardware_memlimit_show() to print one human-readable info line.
References round_up_to_mib(), and uint64_to_str().
Referenced by hardware_memlimit_show().
void hardware_memlimit_show | ( | void | ) |
Display the amount of RAM and memory usage limits and exit.
References memlimit_compress, memlimit_decompress, memlimit_show(), message_verbosity_get(), total_ram, and V_SILENT.
void hardware_init | ( | void | ) |
Initialize some hardware-specific variables, which are needed by other hardware_* functions.
References hardware_memlimit_set(), hardware_threadlimit_set(), lzma_physmem(), and total_ram.
uint32_t threadlimit [static] |
Maximum number of free *coder* threads. This can be set with the --threads=NUM command line option.
Referenced by hardware_threadlimit_get(), and hardware_threadlimit_set().
uint64_t memlimit_compress [static] |
Memory usage limit for compression.
Referenced by hardware_memlimit_get(), hardware_memlimit_set(), and hardware_memlimit_show().
uint64_t memlimit_decompress [static] |
Memory usage limit for decompression.
Referenced by hardware_memlimit_get(), hardware_memlimit_set(), and hardware_memlimit_show().
uint64_t total_ram [static] |
Total amount of physical RAM.
Referenced by hardware_init(), hardware_memlimit_set(), and hardware_memlimit_show().