xz: Extend --robot --info-memory output.

Now it includes everything that the human-readable --info-memory shows.
This commit is contained in:
Lasse Collin 2022-11-07 22:51:16 +02:00
parent 5e2450c75c
commit 49a59f6ca0
2 changed files with 56 additions and 15 deletions

View File

@ -235,9 +235,22 @@ memlimit_show(const char *str, size_t str_columns, uint64_t value)
extern void extern void
hardware_memlimit_show(void) hardware_memlimit_show(void)
{ {
uint32_t cputhreads = 1;
#ifdef MYTHREAD_ENABLED
cputhreads = lzma_cputhreads();
if (cputhreads == 0)
cputhreads = 1;
#endif
if (opt_robot) { if (opt_robot) {
printf("%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\n", total_ram, printf("%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64
memlimit_compress, memlimit_decompress); "\t%" PRIu64 "\t%" PRIu32 "\n",
total_ram,
memlimit_compress,
memlimit_decompress,
hardware_memlimit_mtdec_get(),
memlimit_mt_default,
cputhreads);
} else { } else {
const char *msgs[] = { const char *msgs[] = {
_("Amount of physical memory (RAM):"), _("Amount of physical memory (RAM):"),
@ -263,13 +276,6 @@ hardware_memlimit_show(void)
width_max = w; width_max = w;
} }
uint32_t cputhreads = 1;
#ifdef MYTHREAD_ENABLED
cputhreads = lzma_cputhreads();
if (cputhreads == 0)
cputhreads = 1;
#endif
puts(_("Hardware information:")); puts(_("Hardware information:"));
memlimit_show(msgs[0], width_max, total_ram); memlimit_show(msgs[0], width_max, total_ram);
printf(" %-*s %" PRIu32 "\n", printf(" %-*s %" PRIu32 "\n",

View File

@ -5,7 +5,7 @@
.\" This file has been put into the public domain. .\" This file has been put into the public domain.
.\" You can do whatever you want with this file. .\" You can do whatever you want with this file.
.\" .\"
.TH XZ 1 "2022-10-25" "Tukaani" "XZ Utils" .TH XZ 1 "2022-11-07" "Tukaani" "XZ Utils"
. .
.SH NAME .SH NAME
xz, unxz, xzcat, lzma, unlzma, lzcat \- Compress or decompress .xz and .lzma files xz, unxz, xzcat, lzma, unlzma, lzcat \- Compress or decompress .xz and .lzma files
@ -1960,15 +1960,50 @@ and
.B "xz \-\-robot \-\-info\-memory" .B "xz \-\-robot \-\-info\-memory"
prints a single line with three tab-separated columns: prints a single line with three tab-separated columns:
.IP 1. 4 .IP 1. 4
Total amount of physical memory (RAM) in bytes Total amount of physical memory (RAM) in bytes.
.IP 2. 4 .IP 2. 4
Memory usage limit for compression in bytes. Memory usage limit for compression in bytes
A special value of zero indicates the default setting, .RB ( \-\-memlimit\-compress ).
A special value of
.B 0
indicates the default setting
which for single-threaded mode is the same as no limit. which for single-threaded mode is the same as no limit.
.IP 3. 4 .IP 3. 4
Memory usage limit for decompression in bytes. Memory usage limit for decompression in bytes
A special value of zero indicates the default setting, .RB ( \-\-memlimit\-decompress ).
A special value of
.B 0
indicates the default setting
which for single-threaded mode is the same as no limit. which for single-threaded mode is the same as no limit.
.IP 4. 4
Since
.B xz
5.3.4alpha:
Memory usage for multi-threaded decompression in bytes
.RB ( \-\-memlimit\-mt\-decompress ).
This is never zero because a system-specific default value
shown in the column 5
is used if no limit has been specified explicitly.
This is also never greater than the value in the column 3
even if a larger value has been specified with
.BR \-\-memlimit\-mt\-decompress .
.IP 5. 4
Since
.B xz
5.3.4alpha:
A system-specific default memory usage limit
that is used to limit the number of threads
when compressing with an automatic number of threads
.RB ( \-\-threads=0 )
and no memory usage limit has been specified
.RB ( \-\-memlimit\-compress ).
This is also used as the default value for
.BR \-\-memlimit\-mt\-decompress .
.IP 6. 4
Since
.B xz
5.3.4alpha:
Number of available processor threads.
.PP .PP
In the future, the output of In the future, the output of
.B "xz \-\-robot \-\-info\-memory" .B "xz \-\-robot \-\-info\-memory"