Showing 1 changed files with 57 additions and 3 deletions
+57 -3
garmin_varia_transcode.sh
@@ -258,6 +258,52 @@ format_seconds() {
258 258
   printf '%02d:%02d:%02d' "$h" "$m" "$s"
259 259
 }
260 260
 
261
+print_final_report() {
262
+  local total_elapsed_sec="$1"
263
+  local total_elapsed_fmt="$2"
264
+  local file_post_total_sec="$3"
265
+  local file_post_total_fmt="$4"
266
+  local run_non_file_overhead_sec="$5"
267
+  local run_non_file_overhead_fmt="$6"
268
+  local avg_file_real_time_sec="$7"
269
+  local avg_file_real_time_fmt="$8"
270
+  local avg_video_time_sec="$9"
271
+  local avg_video_time_fmt="${10}"
272
+
273
+  printf '\n'
274
+  printf 'Run Summary\n'
275
+  printf '+---------------------------+-------+\n'
276
+  printf '| %-25s | %-5s |\n' "Metric" "Value"
277
+  printf '+---------------------------+-------+\n'
278
+  printf '| %-25s | %5s |\n' "Videos processed" "$VIDEOS_PROCESSED"
279
+  printf '| %-25s | %5s |\n' "Videos skipped" "$VIDEOS_SKIPPED"
280
+  printf '| %-25s | %5s |\n' "Invalid sources skipped" "$INVALID_SOURCES_SKIPPED"
281
+  printf '| %-25s | %5s |\n' "Destination failures" "$DESTINATION_FAILURES"
282
+  printf '| %-25s | %5s |\n' "JSON copied" "$JSON_COPIED"
283
+  printf '| %-25s | %5s |\n' "JSON skipped" "$JSON_SKIPPED"
284
+  printf '| %-25s | %5s |\n' "Errors" "$ERRORS"
285
+  printf '+---------------------------+-------+\n'
286
+
287
+  printf '\nTimings\n'
288
+  printf '+---------------------------+---------+----------+\n'
289
+  printf '| %-25s | %-7s | %-8s |\n' "Metric" "Seconds" "Elapsed"
290
+  printf '+---------------------------+---------+----------+\n'
291
+  printf '| %-25s | %7s | %-8s |\n' "Total run time" "${total_elapsed_sec}s" "$total_elapsed_fmt"
292
+  printf '| %-25s | %7s | %-8s |\n' "File wall time total" "${TOTAL_FILE_REAL_TIME_SEC}s" "$(format_seconds "$TOTAL_FILE_REAL_TIME_SEC")"
293
+  printf '| %-25s | %7s | %-8s |\n' "Encode time total" "${TOTAL_VIDEO_TIME_SEC}s" "$(format_seconds "$TOTAL_VIDEO_TIME_SEC")"
294
+  printf '| %-25s | %7s | %-8s |\n' "Post-processing total" "${file_post_total_sec}s" "$file_post_total_fmt"
295
+  printf '| %-25s | %7s | %-8s |\n' "Non-file overhead" "${run_non_file_overhead_sec}s" "$run_non_file_overhead_fmt"
296
+  printf '+---------------------------+---------+----------+\n'
297
+
298
+  printf '\nPer-File Averages\n'
299
+  printf '+---------------------------+---------+----------+\n'
300
+  printf '| %-25s | %-7s | %-8s |\n' "Metric" "Seconds" "Elapsed"
301
+  printf '+---------------------------+---------+----------+\n'
302
+  printf '| %-25s | %7s | %-8s |\n' "Average file wall time" "${avg_file_real_time_sec}s" "$avg_file_real_time_fmt"
303
+  printf '| %-25s | %7s | %-8s |\n' "Average encode time" "${avg_video_time_sec}s" "$avg_video_time_fmt"
304
+  printf '+---------------------------+---------+----------+\n'
305
+}
306
+
261 307
 make_temp_log_file() {
262 308
   local temp_path
263 309
   local base_tmp="${TMPDIR:-/tmp}"
@@ -1428,9 +1474,17 @@ main() {
1428 1474
   fi
1429 1475
   run_non_file_overhead_fmt="$(format_seconds "$run_non_file_overhead_sec")"
1430 1476
 
1431
-  log_msg "INFO" "Summary: videos_processed=$VIDEOS_PROCESSED videos_skipped=$VIDEOS_SKIPPED invalid_sources_skipped=$INVALID_SOURCES_SKIPPED destination_failures=$DESTINATION_FAILURES json_copied=$JSON_COPIED json_skipped=$JSON_SKIPPED errors=$ERRORS"
1432
-  log_msg "INFO" "Timing: run_real=${total_elapsed_sec}s / $total_elapsed_fmt, files_real_total=${TOTAL_FILE_REAL_TIME_SEC}s / $(format_seconds "$TOTAL_FILE_REAL_TIME_SEC"), files_encode_total=${TOTAL_VIDEO_TIME_SEC}s / $(format_seconds "$TOTAL_VIDEO_TIME_SEC"), files_post_total=${file_post_total_sec}s / $file_post_total_fmt, run_non_file_overhead=${run_non_file_overhead_sec}s / $run_non_file_overhead_fmt"
1433
-  log_msg "INFO" "Timing(avg): file_real_avg=${avg_file_real_time_sec}s / $avg_file_real_time_fmt, file_encode_avg=${avg_video_time_sec}s / $avg_video_time_fmt"
1477
+  print_final_report \
1478
+    "$total_elapsed_sec" \
1479
+    "$total_elapsed_fmt" \
1480
+    "$file_post_total_sec" \
1481
+    "$file_post_total_fmt" \
1482
+    "$run_non_file_overhead_sec" \
1483
+    "$run_non_file_overhead_fmt" \
1484
+    "$avg_file_real_time_sec" \
1485
+    "$avg_file_real_time_fmt" \
1486
+    "$avg_video_time_sec" \
1487
+    "$avg_video_time_fmt"
1434 1488
 
1435 1489
   if [[ "$ERRORS" -gt 0 ]]; then
1436 1490
     exit 1