From 5b9fd9424bba77716b3f1a703a9c13d061c67b05 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 30 Jul 2006 17:28:08 +0000 Subject: [PATCH] kes Minor fixes for SD write rate and despooling rate. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3206 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kes-1.39 | 1 + bacula/src/stored/append.c | 5 +++-- bacula/src/stored/spool.c | 9 ++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bacula/kes-1.39 b/bacula/kes-1.39 index 995e59bf28..0d01dccb0d 100644 --- a/bacula/kes-1.39 +++ b/bacula/kes-1.39 @@ -15,6 +15,7 @@ kes Create a generic DB routine for getting an int (32/64 bit) from the DB. kes Add more migration code. kes Add a few more files to .cvsignore here and there. +kes Minor fixes for SD write rate and despooling rate. Version 1.39.18 29Jul06 diff --git a/bacula/src/stored/append.c b/bacula/src/stored/append.c index b82d023dcc..6168acc8bb 100644 --- a/bacula/src/stored/append.c +++ b/bacula/src/stored/append.c @@ -253,12 +253,13 @@ bool do_append_data(JCR *jcr) time_t job_elapsed = time(NULL) - jcr->run_time; - if (job_elapsed == 0) + if (job_elapsed <= 0) { job_elapsed = 1; + } Jmsg(dcr->jcr, M_INFO, 0, _("Job write elapsed time = %02d:%02d:%02d, Transfer rate = %s bytes/second\n"), job_elapsed / 3600, job_elapsed % 3600 / 60, job_elapsed % 60, - edit_uint64_with_commas(jcr->dcr->job_spool_size / job_elapsed, ec)); + edit_uint64_with_commas(jcr->JobBytes / job_elapsed, ec)); /* Create Job status for end of session label */ set_jcr_job_status(jcr, ok?JS_Terminated:JS_ErrorTerminated); diff --git a/bacula/src/stored/spool.c b/bacula/src/stored/spool.c index e69fec331f..e91967bef5 100644 --- a/bacula/src/stored/spool.c +++ b/bacula/src/stored/spool.c @@ -247,7 +247,8 @@ static bool despool_data(DCR *dcr, bool commit) Dmsg1(800, "read/write block size = %d\n", block->buf_len); lseek(rdcr->spool_fd, 0, SEEK_SET); /* rewind */ - time_t despool_start = time(NULL); + /* Add run time, to get current wait time */ + time_t despool_start = time(NULL) + jcr->run_time; for ( ; ok; ) { if (job_canceled(jcr)) { @@ -269,10 +270,12 @@ static bool despool_data(DCR *dcr, bool commit) Dmsg3(800, "Write block ok=%d FI=%d LI=%d\n", ok, block->FirstIndex, block->LastIndex); } - time_t despool_elapsed = time(NULL) - despool_start; + /* Subtracting run_time give us elapsed time - wait_time since we started despooling */ + time_t despool_elapsed = time(NULL) - despool_start - jcr->run_time; - if (despool_elapsed == 0) + if (despool_elapsed <= 0) { despool_elapsed = 1; + } Jmsg(dcr->jcr, M_INFO, 0, _("Despooling elapsed time = %02d:%02d:%02d, Transfer rate = %s bytes/second\n"), despool_elapsed / 3600, despool_elapsed % 3600 / 60, despool_elapsed % 60, -- 2.39.5