]> icculus.org git repositories - icculus/xz.git/blob - src/xz/hardware.h
Cleanups to the code that detects the amount of RAM and
[icculus/xz.git] / src / xz / hardware.h
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file       hardware.h
4 /// \brief      Detection of available hardware resources
5 //
6 //  Copyright (C) 2007 Lasse Collin
7 //
8 //  This program is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU Lesser General Public
10 //  License as published by the Free Software Foundation; either
11 //  version 2.1 of the License, or (at your option) any later version.
12 //
13 //  This program is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 //  Lesser General Public License for more details.
17 //
18 ///////////////////////////////////////////////////////////////////////////////
19
20 /// Initialize some hardware-specific variables, which are needed by other
21 /// hardware_* functions.
22 extern void hardware_init(void);
23
24
25 /// Set custom value for maximum number of coder threads.
26 extern void hardware_threadlimit_set(uint32_t threadlimit);
27
28 /// Get the maximum number of coder threads. Some additional helper threads
29 /// are allowed on top of this).
30 extern uint32_t hardware_threadlimit_get(void);
31
32
33 /// Set custom memory usage limit. This is used for both encoding and
34 /// decoding. Zero indicates resetting the limit back to defaults.
35 extern void hardware_memlimit_set(uint64_t memlimit);
36
37 /// Get the memory usage limit for encoding. By default this is 90 % of RAM.
38 extern uint64_t hardware_memlimit_encoder(void);
39
40
41 /// Get the memory usage limit for decoding. By default this is 30 % of RAM.
42 extern uint64_t hardware_memlimit_decoder(void);