Skip to content

Commit

Permalink
No elapsed time info in restore job.
Browse files Browse the repository at this point in the history
Added code sniplet that calculates the elapsed time of a restore Job.
This uses the same code used in the generate_backup_summary() function
now in the generate_restore_summary() function.

Fixes #312: no elapsed time info in restore job
  • Loading branch information
Marco van Wieringen committed Jun 17, 2014
1 parent b8282d2 commit 1086c0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/dird/backup.c
Expand Up @@ -864,7 +864,6 @@ void generate_backup_summary(JCR *jcr, CLIENT_DBR *cr, int msg_type, const char
jcr->res.client->GraceTime +
jcr->res.client->SoftQuotaGracePeriod);


if (RunTime <= 0) {
kbps = 0;
} else {
Expand Down
14 changes: 10 additions & 4 deletions src/dird/restore.c
Expand Up @@ -516,16 +516,18 @@ void native_restore_cleanup(JCR *jcr, int TermCode)
void generate_restore_summary(JCR *jcr, int msg_type, const char *term_msg)
{
char sdt[MAX_TIME_LENGTH], edt[MAX_TIME_LENGTH];
char ec1[30], ec2[30], ec3[30];
char ec1[30], ec2[30], ec3[30], elapsed[50];
char fd_term_msg[100], sd_term_msg[100];
utime_t RunTime;
double kbps;

bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
if (jcr->jr.EndTime - jcr->jr.StartTime > 0) {
kbps = (double)jcr->jr.JobBytes / (1000 * (jcr->jr.EndTime - jcr->jr.StartTime));
} else {
RunTime = jcr->jr.EndTime - jcr->jr.StartTime;
if (RunTime <= 0) {
kbps = 0;
} else {
kbps = (double)jcr->jr.JobBytes / (1000 * (jcr->jr.EndTime - jcr->jr.StartTime));
}
if (kbps < 0.05) {
kbps = 0;
Expand All @@ -543,6 +545,7 @@ void generate_restore_summary(JCR *jcr, int msg_type, const char *term_msg)
" Restore Client: %s\n"
" Start time: %s\n"
" End time: %s\n"
" Elapsed time: %s\n"
" Files Expected: %s\n"
" Files Restored: %s\n"
" Bytes Restored: %s\n"
Expand All @@ -556,6 +559,7 @@ void generate_restore_summary(JCR *jcr, int msg_type, const char *term_msg)
jcr->res.client->name(),
sdt,
edt,
edit_utime(RunTime, elapsed, sizeof(elapsed)),
edit_uint64_with_commas((uint64_t)jcr->ExpectedFiles, ec1),
edit_uint64_with_commas((uint64_t)jcr->jr.JobFiles, ec2),
edit_uint64_with_commas(jcr->jr.JobBytes, ec3),
Expand All @@ -571,6 +575,7 @@ void generate_restore_summary(JCR *jcr, int msg_type, const char *term_msg)
" Restore Client: %s\n"
" Start time: %s\n"
" End time: %s\n"
" Elapsed time: %s\n"
" Files Expected: %s\n"
" Files Restored: %s\n"
" Bytes Restored: %s\n"
Expand All @@ -586,6 +591,7 @@ void generate_restore_summary(JCR *jcr, int msg_type, const char *term_msg)
jcr->res.client->name(),
sdt,
edt,
edit_utime(RunTime, elapsed, sizeof(elapsed)),
edit_uint64_with_commas((uint64_t)jcr->ExpectedFiles, ec1),
edit_uint64_with_commas((uint64_t)jcr->jr.JobFiles, ec2),
edit_uint64_with_commas(jcr->jr.JobBytes, ec3),
Expand Down

0 comments on commit 1086c0d

Please sign in to comment.