mirror of
https://github.com/ckolivas/lrzip.git
synced 2026-01-20 15:20:15 +01:00
Modify maximum ram usable when stdout is being used in preparation for temporary in-ram file during stdout and fix summary shown and 32 bit limits.
This commit is contained in:
parent
885c6b327f
commit
9444441d51
|
|
@ -168,6 +168,7 @@ struct rzip_control {
|
|||
i64 window;
|
||||
unsigned long flags;
|
||||
i64 ramsize;
|
||||
i64 usable_ram;
|
||||
i64 max_chunk;
|
||||
i64 max_mmap;
|
||||
int threads;
|
||||
|
|
|
|||
26
main.c
26
main.c
|
|
@ -210,8 +210,6 @@ static void show_summary(void)
|
|||
{
|
||||
/* OK, if verbosity set, print summary of options selected */
|
||||
if (!INFO) {
|
||||
i64 temp_chunk, temp_window, temp_ramsize; /* to show heurisitic computed values */
|
||||
|
||||
if (!TEST_ONLY)
|
||||
print_verbose("The following options are in effect for this %s.\n",
|
||||
DECOMPRESS ? "DECOMPRESSION" : "COMPRESSION");
|
||||
|
|
@ -255,13 +253,12 @@ static void show_summary(void)
|
|||
print_verbose("Compression Window: %lld = %lldMB\n", control.window, control.window * 100ull);
|
||||
/* show heuristically computed window size */
|
||||
if (!control.window && !UNLIMITED) {
|
||||
temp_ramsize = control.ramsize;
|
||||
if (BITS32)
|
||||
temp_ramsize = MAX(temp_ramsize - 900000000ll, 900000000ll);
|
||||
if (STDIN)
|
||||
temp_chunk = temp_ramsize / 3;
|
||||
i64 temp_chunk, temp_window;
|
||||
|
||||
if (STDOUT || STDIN)
|
||||
temp_chunk = control.maxram;
|
||||
else
|
||||
temp_chunk = temp_ramsize / 3 * 2;
|
||||
temp_chunk = control.maxram * 2;
|
||||
temp_window = temp_chunk / (100 * 1024 * 1024);
|
||||
print_verbose("Heuristically Computed Compression Window: %lld = %lldMB\n", temp_window, temp_window * 100ull);
|
||||
}
|
||||
|
|
@ -638,8 +635,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* Decrease usable ram size on 32 bits due to kernel/userspace split */
|
||||
if (BITS32)
|
||||
control.ramsize = MAX(control.ramsize - 900000000ll, 900000000ll);
|
||||
control.maxram = control.ramsize / 3;
|
||||
control.usable_ram = MAX(control.ramsize - 900000000ll, 900000000ll);
|
||||
else
|
||||
control.usable_ram = control.ramsize;
|
||||
|
||||
/* Set the main nice value to half that of the backend threads since
|
||||
* the rzip stage is usually the rate limiting step */
|
||||
|
|
@ -705,6 +703,14 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* Use less ram when using STDOUT to store the temporary output file */
|
||||
if (STDOUT)
|
||||
control.maxram = control.usable_ram * 2 / 9;
|
||||
else
|
||||
control.maxram = control.usable_ram / 3;
|
||||
if (BITS32)
|
||||
control.maxram = MIN(control.maxram, two_gig);
|
||||
|
||||
show_summary();
|
||||
|
||||
gettimeofday(&start_time, NULL);
|
||||
|
|
|
|||
Loading…
Reference in a new issue