annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/lzma/hardware.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 /* SPDX-License-Identifier: 0BSD */
jpayne@69 2
jpayne@69 3 /**
jpayne@69 4 * \file lzma/hardware.h
jpayne@69 5 * \brief Hardware information
jpayne@69 6 * \note Never include this file directly. Use <lzma.h> instead.
jpayne@69 7 *
jpayne@69 8 * Since liblzma can consume a lot of system resources, it also provides
jpayne@69 9 * ways to limit the resource usage. Applications linking against liblzma
jpayne@69 10 * need to do the actual decisions how much resources to let liblzma to use.
jpayne@69 11 * To ease making these decisions, liblzma provides functions to find out
jpayne@69 12 * the relevant capabilities of the underlying hardware. Currently there
jpayne@69 13 * is only a function to find out the amount of RAM, but in the future there
jpayne@69 14 * will be also a function to detect how many concurrent threads the system
jpayne@69 15 * can run.
jpayne@69 16 *
jpayne@69 17 * \note On some operating systems, these function may temporarily
jpayne@69 18 * load a shared library or open file descriptor(s) to find out
jpayne@69 19 * the requested hardware information. Unless the application
jpayne@69 20 * assumes that specific file descriptors are not touched by
jpayne@69 21 * other threads, this should have no effect on thread safety.
jpayne@69 22 * Possible operations involving file descriptors will restart
jpayne@69 23 * the syscalls if they return EINTR.
jpayne@69 24 */
jpayne@69 25
jpayne@69 26 /*
jpayne@69 27 * Author: Lasse Collin
jpayne@69 28 */
jpayne@69 29
jpayne@69 30 #ifndef LZMA_H_INTERNAL
jpayne@69 31 # error Never include this file directly. Use <lzma.h> instead.
jpayne@69 32 #endif
jpayne@69 33
jpayne@69 34
jpayne@69 35 /**
jpayne@69 36 * \brief Get the total amount of physical memory (RAM) in bytes
jpayne@69 37 *
jpayne@69 38 * This function may be useful when determining a reasonable memory
jpayne@69 39 * usage limit for decompressing or how much memory it is OK to use
jpayne@69 40 * for compressing.
jpayne@69 41 *
jpayne@69 42 * \return On success, the total amount of physical memory in bytes
jpayne@69 43 * is returned. If the amount of RAM cannot be determined,
jpayne@69 44 * zero is returned. This can happen if an error occurs
jpayne@69 45 * or if there is no code in liblzma to detect the amount
jpayne@69 46 * of RAM on the specific operating system.
jpayne@69 47 */
jpayne@69 48 extern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow;
jpayne@69 49
jpayne@69 50
jpayne@69 51 /**
jpayne@69 52 * \brief Get the number of processor cores or threads
jpayne@69 53 *
jpayne@69 54 * This function may be useful when determining how many threads to use.
jpayne@69 55 * If the hardware supports more than one thread per CPU core, the number
jpayne@69 56 * of hardware threads is returned if that information is available.
jpayne@69 57 *
jpayne@69 58 * \return On success, the number of available CPU threads or cores is
jpayne@69 59 * returned. If this information isn't available or an error
jpayne@69 60 * occurs, zero is returned.
jpayne@69 61 */
jpayne@69 62 extern LZMA_API(uint32_t) lzma_cputhreads(void) lzma_nothrow;