xz: Revise --info-memory output.

The strings could be more descriptive but it's good
to have some version of this committed now.

--robot mode wasn't changed yet.
This commit is contained in:
Lasse Collin 2022-08-19 23:32:22 +03:00
parent f864f6d42e
commit 02a777f9c4
2 changed files with 27 additions and 6 deletions

View File

@ -241,8 +241,11 @@ hardware_memlimit_show(void)
} else {
const char *msgs[] = {
_("Amount of physical memory (RAM):"),
_("Memory usage limit for compression:"),
_("Memory usage limit for decompression:"),
_("Number of processor threads:"),
_("Compression:"),
_("Decompression:"),
_("Multi-threaded decompression:"),
_("Default for -T0:"),
};
size_t width_max = 1;
@ -260,9 +263,26 @@ hardware_memlimit_show(void)
width_max = w;
}
uint32_t cputhreads = 1;
#ifdef MYTHREAD_ENABLED
cputhreads = lzma_cputhreads();
if (cputhreads == 0)
cputhreads = 1;
#endif
puts(_("Hardware information:"));
memlimit_show(msgs[0], width_max, total_ram);
memlimit_show(msgs[1], width_max, memlimit_compress);
memlimit_show(msgs[2], width_max, memlimit_decompress);
printf(" %-*s %" PRIu32 "\n",
tuklib_mbstr_fw(msgs[1], (int)(width_max)),
msgs[1], cputhreads);
putchar('\n');
puts(_("Memory usage limits:"));
memlimit_show(msgs[2], width_max, memlimit_compress);
memlimit_show(msgs[3], width_max, memlimit_decompress);
memlimit_show(msgs[4], width_max,
hardware_memlimit_mtdec_get());
memlimit_show(msgs[5], width_max, memlimit_mt_default);
}
tuklib_exit(E_SUCCESS, E_ERROR, message_verbosity_get() != V_SILENT);

View File

@ -1867,6 +1867,7 @@ for details.
.TP
.B \-\-info\-memory
Display, in human-readable format, how much physical memory (RAM)
and how many processor threads
.B xz
thinks the system has and the memory usage limits for compression
and decompression, and exit successfully.