hardware.h File Reference

Detection of available hardware resources. More...

## Functions

void | hardware_init (void)
void | hardware_threads_set (uint32_t threadlimit)
| Set the maximum number of worker threads. More...
uint32_t | hardware_threads_get (void)
| Get the maximum number of worker threads. More...
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. More...
void | hardware_memlimit_show (void) lzma_attribute((__noreturn__))
| Display the amount of RAM and memory usage limits and exit. More...

## Detailed Description

Detection of available hardware resources.

## Function Documentation

## hardware_init()

void hardware_init | ( | void |  | ) |

Initialize some hardware-specific variables, which are needed by other hardware_* functions.

References hardware_memlimit_set(), lzma_physmem(), and total_ram.

## hardware_threads_set()

void hardware_threads_set | ( | uint32_t | threadlimit | ) |

Set the maximum number of worker threads.

References lzma_cputhreads(), and threads_max.

## hardware_threads_get()

uint32_t hardware_threads_get | ( | void |  | ) |

Get the maximum number of worker threads.

References threads_max.

## hardware_memlimit_set()

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].

Referenced by hardware_init().

## hardware_memlimit_get()

uint64_t hardware_memlimit_get | ( | enum operation_mode | mode | ) |

Get the current memory usage limit for compression or decompression.

Referenced by message_mem_needed().

## hardware_memlimit_show()

void hardware_memlimit_show | ( | void |  | ) |

Display the amount of RAM and memory usage limits and exit.