added '-m' command line option

Added an option to override detected available ram. Can be used
to limit the amount of ram used by lrzip.
This commit is contained in:
Elmir Jagudin 2014-06-18 16:24:19 +02:00
parent 2c151a0d1b
commit 14a824da2c

7
main.c
View file

@ -94,6 +94,8 @@ static void usage(void)
print_output(" -L level set lzma/bzip2/gzip compression level (1-9, default 7)\n"); print_output(" -L level set lzma/bzip2/gzip compression level (1-9, default 7)\n");
print_output(" -N value Set nice value to value (default 19)\n"); print_output(" -N value Set nice value to value (default 19)\n");
print_output(" -p value Set processor count to override number of threads\n"); print_output(" -p value Set processor count to override number of threads\n");
print_output(" -m size Set maximim available ram in hundreds of MB\n");
print_output(" overrides detected ammount of available ram\n");
print_output(" -T Disable LZO compressibility testing\n"); print_output(" -T Disable LZO compressibility testing\n");
print_output(" -U Use unlimited window size beyond ramsize (potentially much slower)\n"); print_output(" -U Use unlimited window size beyond ramsize (potentially much slower)\n");
print_output(" -w size maximum compression window in hundreds of MB\n"); print_output(" -w size maximum compression window in hundreds of MB\n");
@ -219,7 +221,7 @@ int main(int argc, char *argv[])
else if (!strstr(eptr,"NOCONFIG")) else if (!strstr(eptr,"NOCONFIG"))
read_config(control); read_config(control);
while ((c = getopt(argc, argv, "bcdDefghHiklL:nN:o:O:p:qS:tTUvVw:z?")) != -1) { while ((c = getopt(argc, argv, "bcdDefghHiklL:nN:o:O:p:qS:tTUm:vVw:z?")) != -1) {
switch (c) { switch (c) {
case 'b': case 'b':
if (control->flags & FLAG_NOT_LZMA) if (control->flags & FLAG_NOT_LZMA)
@ -328,6 +330,9 @@ int main(int argc, char *argv[])
case 'U': case 'U':
control->flags |= FLAG_UNLIMITED; control->flags |= FLAG_UNLIMITED;
break; break;
case 'm':
control->ramsize = atol(optarg) * 1024 * 1024 * 100;
break;
case 'v': case 'v':
/* set verbosity flag */ /* set verbosity flag */
if (!(control->flags & FLAG_VERBOSITY) && !(control->flags & FLAG_VERBOSITY_MAX)) if (!(control->flags & FLAG_VERBOSITY) && !(control->flags & FLAG_VERBOSITY_MAX))