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