$!------------------------------------------------------------------ $! CALC_BACK.COM $! Calculate the performance of the image backups $!------------------------------------------------------------------ $! Check if the user entered a date $ if p1 .eqs. "" then goto show_date $! Init the counter and accumulators $ diskcount == 0 $ kbused == 0 $ secondsused == 0 $! $! Check if there are any files that match the date $ if f$search( "tapes:image*_''p1'.lst", 1 ) .eqs. "" then exit $! $! Write the header $ write sys$output "Disk KB Used KB/s Time" $! $! Loop through all of the files generating the necessary output $loop: $! Get the file name $ file = f$search( "tapes:image*_''p1'.lst", 2 ) $! $! If it is blank, then show the totals $ if file .eqs. "" then goto show_totals $! $ diskcount == diskcount + 1 $! $! Get the creation and modification dates on the file $ start = f$element( 1, " ", f$edit( f$file( "''file'", "cdt" ), "trim" ) ) $ end = f$element( 1, " ", f$edit( f$file( "''file'", "rdt" ), "trim" ) ) $! $! Get the number of blocks backed up from the trailer record $ pipe search &file "Total of" | - ( read sys$input aline ; aline=f$element(4," ",aline) ; define/job/nolog ptemp &aline ) $ used = f$trnlnm( "ptemp" ) $! $! Get the disk name $ disk = f$element( 2, "_", file ) $! $! Calculate the performance and display $ call calc_backup_performance 'disk' 'start' 'end' 'used' $! $ goto loop $done: $ exit $! $show_totals: $ call calc_backup_performance TOTAL 'diskcount' 'secondsused' 'kbused' $! write sys$output "''diskcount'-''kbused'-''secondsused'" $ exit $! $show_date: $ write sys$output "You need to enter a date like: ", f$cvtime( , "ABSOLUTE", "DATE" ) $ exit $!----------------------------------------------------------------------- $calc_backup_performance: subroutine $! $! P1 = Disk name $! P2 = Start Time $! P3 = End Time $! P4 = Used blocks $ if p1 .eqs. "TOTAL" $ then used = p4 $ elapsed_seconds = p3 $ diskname = "Total: ''p2'" $ goto do_totals $ endif $! $ if p1 .eqs. "" then exit $ if p2 .eqs. "" then exit $ if p3 .eqs. "" then exit $ if p4 .eqs. "" then exit $! $ diskname = p1 $ start_time = p2 $ end_time = p3 $ used = p4 $! $! Calculate the number of seconds at the start $ start_seconds = ( f$cvtime( start_time,, "hour" ) * 3600 ) +- ( f$cvtime( start_time,, "minute" ) * 60 ) +- ( f$cvtime( start_time,, "second" ) ) $! $! Calculate the number of seconds at the end $ end_seconds = ( f$cvtime( end_time,, "hour" ) * 3600 ) +- ( f$cvtime( end_time,, "minute" ) * 60 ) +- ( f$cvtime( end_time,, "second" ) ) $! $! if we went over midnite, then add a days worth of seconds to the end $ if start_seconds .ge. end_seconds $ then end_seconds = end_seconds + 86400 $ endif $! $! Calculate the number of elapsed seconds $ elapsed_seconds = end_seconds - start_seconds $! $do_totals: $! $! Calculate the elapsed time $ elapsed_sec = elapsed_seconds - ((elapsed_seconds / 60)*60) $ elapsed_temp = (elapsed_seconds - elapsed_sec) / 60 $ elapsed_min = elapsed_temp - ((elapsed_temp / 60)*60) $ elapsed_hour = (elapsed_temp - elapsed_min) / 60 $! $! Convert blocks to KB $ used_kb = used / 2 $! $ if p1 .nes. "TOTAL" $ then kbused == kbused + used_kb $ secondsused == secondsused + elapsed_seconds $ else used_kb = kbused $ endif $! $! Calculate KB per second integer part $ kb_per_s_int = used_kb / elapsed_seconds $! $! Calculate KB per second decimal part $ kb_per_s_dec = ( used_kb / ( elapsed_seconds / 1000 ) ) -- ( kb_per_s_int * 1000 ) $ kb_per_s_dec = f$extract( 0, 2, kb_per_s_dec ) * 1 $! $! Write the values to the screen $ write sys$output f$fao( "!10AS!10UL!10UW.!UW!8UW:!2ZW:!2ZW", diskname, used_kb, kb_per_s_int, kb_per_s_dec, - elapsed_hour, elapsed_min, elapsed_sec ) $! $ exit $ endsubroutine