Ejemplo n.º 1
0
    def report_stats(self, output, fs, quiet):
        duration = time.time() - self.started
        duration_string = obnamlib.humanise_duration(duration)

        chunk_amount, chunk_unit = obnamlib.humanise_size(self.uploaded_bytes)

        ul_amount, ul_unit = obnamlib.humanise_size(fs.bytes_written)

        dl_amount, dl_unit = obnamlib.humanise_size(fs.bytes_read)

        overhead_bytes = (fs.bytes_read +
                          (fs.bytes_written - self.uploaded_bytes))
        overhead_bytes = max(0, overhead_bytes)
        overhead_amount, overhead_unit = obnamlib.humanise_size(overhead_bytes)
        if fs.bytes_written > 0:
            overhead_percent = 100.0 * overhead_bytes / fs.bytes_written
        else:
            overhead_percent = 0.0

        speed_amount, speed_unit = obnamlib.humanise_speed(
            self.uploaded_bytes, duration)

        logging.info('Backup performance statistics:')
        logging.info('* files found: %s', self.file_count)
        logging.info('* files backed up: %s', self.backed_up_count)
        logging.info('* uploaded chunk data: %s bytes (%s %s)',
                     self.uploaded_bytes, chunk_amount, chunk_unit)
        logging.info(
            '* total uploaded data (incl. metadata): %s bytes (%s %s)',
            fs.bytes_written, ul_amount, ul_unit)
        logging.info(
            '* total downloaded data (incl. metadata): %s bytes (%s %s)',
            fs.bytes_read, dl_amount, dl_unit)
        logging.info('* transfer overhead: %s bytes (%s %s)', overhead_bytes,
                     overhead_amount, overhead_unit)
        logging.info('* duration: %s s (%s)', duration, duration_string)
        logging.info('* average speed: %s %s', speed_amount, speed_unit)

        scanned_amount, scanned_unit = obnamlib.humanise_size(
            self.scanned_bytes)

        if not quiet:
            output.write(
                'Backed up %d files (of %d found), containing %.1f %s.\n' %
                (self.backed_up_count, self.file_count, scanned_amount,
                 scanned_unit))
            output.write('Uploaded %.1f %s file data in %s at %.1f %s '
                         'average speed.\n' %
                         (chunk_amount, chunk_unit, duration_string,
                          speed_amount, speed_unit))
            output.write('Total download amount %.1f %s.\n' %
                         (dl_amount, dl_unit))
            output.write('Total upload amount %.1f %s. '
                         'Overhead was %.1f %s (%.1f %%).\n' %
                         (ul_amount, ul_unit, overhead_amount, overhead_unit,
                          overhead_percent))
Ejemplo n.º 2
0
    def report_stats(self, fs):
        duration = time.time() - self.started
        duration_string = obnamlib.humanise_duration(duration)

        chunk_amount, chunk_unit = obnamlib.humanise_size(
            self.uploaded_bytes)

        fs_amount, fs_unit = obnamlib.humanise_size(fs.bytes_written)

        dl_amount, dl_unit = obnamlib.humanise_size(fs.bytes_read)

        overhead_bytes = (
            fs.bytes_read + (fs.bytes_written - self.uploaded_bytes))
        overhead_bytes = max(0, overhead_bytes)
        overhead_amount, overhead_unit = obnamlib.humanise_size(
            overhead_bytes)

        speed_amount, speed_unit = obnamlib.humanise_speed(
            self.uploaded_bytes, duration)

        logging.info(
            'Backup performance statistics:')
        logging.info(
            '* files found: %s',
            self.file_count)
        logging.info(
            '* files backed up: %s',
            self.backed_up_count)
        logging.info(
            '* uploaded chunk data: %s bytes (%s %s)',
            self.uploaded_bytes, chunk_amount, chunk_unit)
        logging.info(
            '* total uploaded data (incl. metadata): %s bytes (%s %s)',
            fs.bytes_written, fs_amount, fs_unit)
        logging.info(
            '* total downloaded data (incl. metadata): %s bytes (%s %s)',
            fs.bytes_read, dl_amount, dl_unit)
        logging.info(
            '* transfer overhead: %s bytes (%s %s)',
            overhead_bytes, overhead_amount, overhead_unit)
        logging.info(
            '* duration: %s s (%s)',
            duration, duration_string)
        logging.info(
            '* average speed: %s %s',
            speed_amount, speed_unit)

        self._ts.notify(
            'Backed up %d files (of %d found), '
            'uploaded %.1f %s in %s at %.1f %s average speed' %
                (self.backed_up_count, self.file_count,
                 chunk_amount, chunk_unit,
                 duration_string, speed_amount, speed_unit))
Ejemplo n.º 3
0
    def report_stats(self):
        duration = time.time() - self.started
        size_amount, size_unit = obnamlib.humanise_size(self.downloaded_bytes)
        speed_amount, speed_unit = obnamlib.humanise_speed(
            self.downloaded_bytes, duration)
        duration_string = obnamlib.humanise_duration(duration)

        logging.info('Restore performance statistics:')
        logging.info('* files restored: %s', self.file_count)
        logging.info('* downloaded data: %s bytes (%s %s)',
                     self.downloaded_bytes, size_amount, size_unit)
        logging.info('* duration: %s s', duration)
        logging.info('* average speed: %s %s', speed_amount, speed_unit)
        self.app.ts.notify(
            'Restored %d files, '
            'downloaded %.1f %s in %s at %.1f %s average speed' %
            (self.file_count, size_amount, size_unit, duration_string,
             speed_amount, speed_unit))
Ejemplo n.º 4
0
    def report_stats(self):
        duration = time.time() - self.started
        size_amount, size_unit = obnamlib.humanise_size(
            self.downloaded_bytes)
        speed_amount, speed_unit = obnamlib.humanise_speed(
            self.downloaded_bytes, duration)
        duration_string = obnamlib.humanise_duration(duration)

        logging.info('Restore performance statistics:')
        logging.info('* files restored: %s', self.file_count)
        logging.info(
            '* downloaded data: %s bytes (%s %s)',
            self.downloaded_bytes, size_amount, size_unit)
        logging.info('* duration: %s s', duration)
        logging.info('* average speed: %s %s', speed_amount, speed_unit)
        self.app.ts.notify(
            'Restored %d files, '
            'downloaded %.1f %s in %s at %.1f %s average speed' %
            (self.file_count,
             size_amount, size_unit,
             duration_string, speed_amount, speed_unit))
Ejemplo n.º 5
0
    def report_stats(self, fs):
        duration = time.time() - self.started
        duration_string = obnamlib.humanise_duration(duration)

        chunk_amount, chunk_unit = obnamlib.humanise_size(self.uploaded_bytes)

        fs_amount, fs_unit = obnamlib.humanise_size(fs.bytes_written)

        dl_amount, dl_unit = obnamlib.humanise_size(fs.bytes_read)

        overhead_bytes = (fs.bytes_read +
                          (fs.bytes_written - self.uploaded_bytes))
        overhead_bytes = max(0, overhead_bytes)
        overhead_amount, overhead_unit = obnamlib.humanise_size(overhead_bytes)

        speed_amount, speed_unit = obnamlib.humanise_speed(
            self.uploaded_bytes, duration)

        logging.info('Backup performance statistics:')
        logging.info('* files found: %s', self.file_count)
        logging.info('* files backed up: %s', self.backed_up_count)
        logging.info('* uploaded chunk data: %s bytes (%s %s)',
                     self.uploaded_bytes, chunk_amount, chunk_unit)
        logging.info(
            '* total uploaded data (incl. metadata): %s bytes (%s %s)',
            fs.bytes_written, fs_amount, fs_unit)
        logging.info(
            '* total downloaded data (incl. metadata): %s bytes (%s %s)',
            fs.bytes_read, dl_amount, dl_unit)
        logging.info('* transfer overhead: %s bytes (%s %s)', overhead_bytes,
                     overhead_amount, overhead_unit)
        logging.info('* duration: %s s (%s)', duration, duration_string)
        logging.info('* average speed: %s %s', speed_amount, speed_unit)

        self._ts.notify(
            'Backed up %d files (of %d found), '
            'uploaded %.1f %s in %s at %.1f %s average speed' %
            (self.backed_up_count, self.file_count, chunk_amount, chunk_unit,
             duration_string, speed_amount, speed_unit))
Ejemplo n.º 6
0
    def report_stats(self, output, fs, quiet, report=None):  # pragma: no cover
        if report is None:
            report = self.compute_report(fs)

        duration_string = obnamlib.humanise_duration(report['duration'])

        chunk_amount, chunk_unit = obnamlib.humanise_size(
            report['uploaded-total-bytes'])

        ul_amount, ul_unit = obnamlib.humanise_size(
            report['uploaded-total-bytes'])

        dl_amount, dl_unit = obnamlib.humanise_size(
            report['downloaded-total-bytes'])

        overhead_bytes = (
            report['downloaded-total-bytes'] +
            (report['uploaded-total-bytes'] - report['uploaded-total-bytes']))
        overhead_bytes = max(0, overhead_bytes)
        overhead_amount, overhead_unit = obnamlib.humanise_size(overhead_bytes)
        if report['uploaded-total-bytes'] > 0:
            overhead_percent = (
                100.0 * overhead_bytes / report['uploaded-total-bytes'])
        else:
            overhead_percent = 0.0

        speed_amount, speed_unit = obnamlib.humanise_speed(
            report['uploaded-total-bytes'], report['duration'])

        logging.info(
            'Backup performance statistics:')
        logging.info(
            '* files found: %s',
            report['file-count'])
        logging.info(
            '* files backed up: %s',
            report['backed-up-count'])
        logging.info(
            '* uploaded chunk data: %s bytes (%s %s)',
            report['uploaded-total-bytes'], chunk_amount, chunk_unit)
        logging.info(
            '* total uploaded data (incl. metadata): %s bytes (%s %s)',
            report['uploaded-total-bytes'], ul_amount, ul_unit)
        logging.info(
            '* total downloaded data (incl. metadata): %s bytes (%s %s)',
            report['downloaded-total-bytes'], dl_amount, dl_unit)
        logging.info(
            '* transfer overhead: %s bytes (%s %s)',
            overhead_bytes, overhead_amount, overhead_unit)
        logging.info(
            '* duration: %s s (%s)',
            report['duration'], duration_string)
        logging.info(
            '* average speed: %s %s',
            speed_amount, speed_unit)

        scanned_amount, scanned_unit = obnamlib.humanise_size(
            report['scanned-bytes'])

        if not quiet:
            output.write(
                'Backed up %d files (of %d found), containing %.1f %s.\n' %
                (report['backed-up-count'],
                 report['file-count'],
                 scanned_amount,
                 scanned_unit))
            output.write(
                'Uploaded %.1f %s file data in %s at %.1f %s '
                'average speed.\n' %
                (chunk_amount,
                 chunk_unit,
                 duration_string,
                 speed_amount,
                 speed_unit))
            output.write(
                'Total download amount %.1f %s.\n' %
                (dl_amount,
                 dl_unit))
            output.write(
                'Total upload amount %.1f %s. '
                'Overhead was %.1f %s (%.1f %%).\n' %
                (ul_amount,
                 ul_unit,
                 overhead_amount,
                 overhead_unit,
                 overhead_percent))
Ejemplo n.º 7
0
    def report_stats(self, output, fs):
        duration = time.time() - self.started
        duration_string = obnamlib.humanise_duration(duration)

        chunk_amount, chunk_unit = obnamlib.humanise_size(
            self.uploaded_bytes)

        ul_amount, ul_unit = obnamlib.humanise_size(fs.bytes_written)

        dl_amount, dl_unit = obnamlib.humanise_size(fs.bytes_read)

        overhead_bytes = (
            fs.bytes_read + (fs.bytes_written - self.uploaded_bytes))
        overhead_bytes = max(0, overhead_bytes)
        overhead_amount, overhead_unit = obnamlib.humanise_size(
            overhead_bytes)
        if fs.bytes_written > 0:
            overhead_percent = 100.0 * overhead_bytes / fs.bytes_written
        else:
            overhead_percent = 0.0

        speed_amount, speed_unit = obnamlib.humanise_speed(
            self.uploaded_bytes, duration)

        logging.info(
            'Backup performance statistics:')
        logging.info(
            '* files found: %s',
            self.file_count)
        logging.info(
            '* files backed up: %s',
            self.backed_up_count)
        logging.info(
            '* uploaded chunk data: %s bytes (%s %s)',
            self.uploaded_bytes, chunk_amount, chunk_unit)
        logging.info(
            '* total uploaded data (incl. metadata): %s bytes (%s %s)',
            fs.bytes_written, ul_amount, ul_unit)
        logging.info(
            '* total downloaded data (incl. metadata): %s bytes (%s %s)',
            fs.bytes_read, dl_amount, dl_unit)
        logging.info(
            '* transfer overhead: %s bytes (%s %s)',
            overhead_bytes, overhead_amount, overhead_unit)
        logging.info(
            '* duration: %s s (%s)',
            duration, duration_string)
        logging.info(
            '* average speed: %s %s',
            speed_amount, speed_unit)

        scanned_amount, scanned_unit = obnamlib.humanise_size(
            self.scanned_bytes)

        output.write(
            'Backed up %d files (of %d found), containing %.1f %s.\n' %
            (self.backed_up_count,
             self.file_count,
             scanned_amount,
             scanned_unit))
        output.write(
            'Uploaded %.1f %s file data in %s at %.1f %s average speed.\n' %
            (chunk_amount,
             chunk_unit,
             duration_string,
             speed_amount,
             speed_unit))
        output.write(
            'Total download amount %.1f %s.\n' %
            (dl_amount,
             dl_unit))
        output.write(
            'Total upload amount %.1f %s. Overhead was %.1f %s (%.1f %%).\n' %
            (ul_amount,
             ul_unit,
             overhead_amount,
             overhead_unit,
             overhead_percent))