Rizin
unix-like reverse engineering framework and cli tools
|
Detection of available hardware resources. More...
#include "private.h"
Go to the source code of this file.
Functions | |
void | hardware_threads_set (uint32_t n) |
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... | |
static void | memlimit_show (const char *str, uint64_t value) |
Helper for hardware_memlimit_show() to print one human-readable info line. More... | |
void | hardware_memlimit_show (void) |
Display the amount of RAM and memory usage limits and exit. More... | |
void | hardware_init (void) |
Variables | |
static uint32_t | threads_max = 1 |
static uint64_t | memlimit_compress |
Memory usage limit for compression. More... | |
static uint64_t | memlimit_decompress |
Memory usage limit for decompression. More... | |
static uint64_t | total_ram |
Total amount of physical RAM. More... | |
Detection of available hardware resources.
Definition in file hardware.c.
void hardware_init | ( | void | ) |
Initialize some hardware-specific variables, which are needed by other hardware_* functions.
Definition at line 169 of file hardware.c.
References ASSUME_RAM, hardware_memlimit_set(), and total_ram.
Referenced by main().
uint64_t hardware_memlimit_get | ( | enum operation_mode | mode | ) |
Get the current memory usage limit for compression or decompression.
Definition at line 112 of file hardware.c.
References memlimit, memlimit_compress, memlimit_decompress, MODE_COMPRESS, and UINT64_MAX.
Referenced by coder_init(), message_mem_needed(), and parse_indexes().
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].
Definition at line 62 of file hardware.c.
References assert(), memlimit_compress, memlimit_decompress, total_ram, UINT64_C, and UINT64_MAX.
Referenced by hardware_init(), and parse_memlimit().
void hardware_memlimit_show | ( | void | ) |
Display the amount of RAM and memory usage limits and exit.
Definition at line 148 of file hardware.c.
References _, E_ERROR, E_SUCCESS, memlimit_compress, memlimit_decompress, memlimit_show(), message_verbosity_get(), opt_robot, printf(), PRIu64, total_ram, tuklib_exit, and V_SILENT.
Referenced by parse_real().
uint32_t hardware_threads_get | ( | void | ) |
Get the maximum number of worker threads.
Definition at line 55 of file hardware.c.
References threads_max.
Referenced by coder_init(), coder_normal(), and split_block().
void hardware_threads_set | ( | uint32_t | n | ) |
Set the maximum number of worker threads.
Definition at line 31 of file hardware.c.
References n, and threads_max.
Referenced by coder_init(), and parse_real().
Helper for hardware_memlimit_show() to print one human-readable info line.
Definition at line 131 of file hardware.c.
References _, printf(), round_up_to_mib(), cmd_descs_generate::str, UINT64_MAX, uint64_to_str(), and value.
Referenced by hardware_memlimit_show().
|
static |
Memory usage limit for compression.
Definition at line 21 of file hardware.c.
Referenced by hardware_memlimit_get(), hardware_memlimit_set(), and hardware_memlimit_show().
|
static |
Memory usage limit for decompression.
Definition at line 24 of file hardware.c.
Referenced by hardware_memlimit_get(), hardware_memlimit_set(), and hardware_memlimit_show().
|
static |
Maximum number of worker threads. This can be set with the –threads=NUM command line option.
Definition at line 18 of file hardware.c.
Referenced by hardware_threads_get(), hardware_threads_set(), and init_encoder().
|
static |
Total amount of physical RAM.
Definition at line 27 of file hardware.c.
Referenced by hardware_init(), hardware_memlimit_set(), and hardware_memlimit_show().