442 {
444#ifndef CADICAL_QUIET
445 if (internal->opts.quiet)
446 print = false;
447 else if (internal->opts.verbose > 0)
448 print = true;
449#endif
450 if (close_file == 0) {
451 if (print)
452 MSG (
"disconnecting from '%s'",
name ());
453 }
454 if (close_file == 1) {
455 if (print)
456 MSG (
"closing file '%s'",
name ());
457 fclose (file);
458 }
459 if (close_file == 2) {
460 if (print)
461 MSG (
"closing input pipe to read '%s'",
name ());
463 }
464#ifndef _WIN32
465 if (close_file == 3) {
466 if (print)
467 MSG (
"closing output pipe to write '%s'",
name ());
468 fclose (file);
469 waitpid (child_pid, 0, 0);
470#if defined(__APPLE__) || defined(__MACH__)
471 compressed_file_writing_mutex.unlock ();
472#endif
473 }
474#endif
475 file = 0;
476
477
478
479#ifndef CADICAL_QUIET
480 if (print) {
481 if (writing) {
482 uint64_t written_bytes =
bytes ();
483 double written_mb = written_bytes / (double) (1 << 20);
484 MSG (
"after writing %" PRIu64
" bytes %.1f MB", written_bytes,
485 written_mb);
486 if (close_file == 3) {
487 size_t actual_bytes =
size (
name ());
488 if (actual_bytes) {
489 double actual_mb = actual_bytes / (double) (1 << 20);
490 MSG (
"deflated to %zd bytes %.1f MB", actual_bytes, actual_mb);
491 MSG (
"factor %.2f (%.2f%% compression)",
492 relative (written_bytes, actual_bytes),
493 percent (actual_bytes, written_bytes));
494 } else
495 MSG (
"but could not determine actual size of written file");
496 }
497 } else {
498 uint64_t read_bytes =
bytes ();
499 double read_mb = read_bytes / (double) (1 << 20);
500 MSG (
"after reading %" PRIu64
" bytes %.1f MB", read_bytes, read_mb);
501 if (close_file == 2) {
502 size_t actual_bytes =
size (
name ());
503 double actual_mb = actual_bytes / (double) (1 << 20);
504 MSG (
"inflated from %zd bytes %.1f MB", actual_bytes, actual_mb);
505 MSG (
"factor %.2f (%.2f%% compression)",
506 relative (read_bytes, actual_bytes),
507 percent (actual_bytes, read_bytes));
508 }
509 }
510 }
511#endif
512}
#define CADICAL_assert(ignore)
const char * name() const
static size_t size(const char *path)
double relative(double a, double b)
double percent(double a, double b)