1207753Smm/**
2207753Smm * \file        lzma/hardware.h
3207753Smm * \brief       Hardware information
4207753Smm *
5207753Smm * Since liblzma can consume a lot of system resources, it also provides
6207753Smm * ways to limit the resource usage. Applications linking against liblzma
7207753Smm * need to do the actual decisions how much resources to let liblzma to use.
8207753Smm * To ease making these decisions, liblzma provides functions to find out
9360523Sdelphij * the relevant capabilities of the underlying hardware. Currently there
10207753Smm * is only a function to find out the amount of RAM, but in the future there
11207753Smm * will be also a function to detect how many concurrent threads the system
12207753Smm * can run.
13207753Smm *
14207753Smm * \note        On some operating systems, these function may temporarily
15207753Smm *              load a shared library or open file descriptor(s) to find out
16207753Smm *              the requested hardware information. Unless the application
17207753Smm *              assumes that specific file descriptors are not touched by
18207753Smm *              other threads, this should have no effect on thread safety.
19207753Smm *              Possible operations involving file descriptors will restart
20207753Smm *              the syscalls if they return EINTR.
21207753Smm */
22207753Smm
23207753Smm/*
24207753Smm * Author: Lasse Collin
25207753Smm *
26207753Smm * This file has been put into the public domain.
27207753Smm * You can do whatever you want with this file.
28207753Smm *
29207753Smm * See ../lzma.h for information about liblzma as a whole.
30207753Smm */
31207753Smm
32207753Smm#ifndef LZMA_H_INTERNAL
33207753Smm#	error Never include this file directly. Use <lzma.h> instead.
34207753Smm#endif
35207753Smm
36207753Smm
37207753Smm/**
38207753Smm * \brief       Get the total amount of physical memory (RAM) in bytes
39207753Smm *
40207753Smm * This function may be useful when determining a reasonable memory
41207753Smm * usage limit for decompressing or how much memory it is OK to use
42215187Smm * for compressing.
43207753Smm *
44207753Smm * \return      On success, the total amount of physical memory in bytes
45207753Smm *              is returned. If the amount of RAM cannot be determined,
46207753Smm *              zero is returned. This can happen if an error occurs
47207753Smm *              or if there is no code in liblzma to detect the amount
48207753Smm *              of RAM on the specific operating system.
49207753Smm */
50207753Smmextern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow;
51278433Srpaulo
52278433Srpaulo
53278433Srpaulo/**
54278433Srpaulo * \brief       Get the number of processor cores or threads
55278433Srpaulo *
56278433Srpaulo * This function may be useful when determining how many threads to use.
57278433Srpaulo * If the hardware supports more than one thread per CPU core, the number
58278433Srpaulo * of hardware threads is returned if that information is available.
59278433Srpaulo *
60278433Srpaulo * \brief       On success, the number of available CPU threads or cores is
61278433Srpaulo *              returned. If this information isn't available or an error
62278433Srpaulo *              occurs, zero is returned.
63278433Srpaulo */
64278433Srpauloextern LZMA_API(uint32_t) lzma_cputhreads(void) lzma_nothrow;
65