changeset 614:02bdb2f366bc

fc-xram: added transfer time reporting
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 24 Feb 2020 23:07:03 +0000
parents ab4021fb1c66
children 39b74c39d914
files loadtools/chainload.c
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/loadtools/chainload.c	Mon Feb 24 22:30:00 2020 +0000
+++ b/loadtools/chainload.c	Mon Feb 24 23:07:03 2020 +0000
@@ -8,6 +8,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
+#include <time.h>
 #include "srecreader.h"
 
 struct srecreader xramimage;
@@ -38,6 +39,8 @@
 	int resp;
 	unsigned long rec_count;
 	char *argv[3], srecarg[516];
+	time_t start_time, finish_time;
+	unsigned duration, mm, ss;
 
 	if (open_srec_file(&xramimage) < 0)
 		exit(1);
@@ -67,8 +70,10 @@
 				xramimage.record_type);
 			exit(1);
 		}
-		if (xramimage.record_type == '7')
+		if (xramimage.record_type == '7') {
+			time(&finish_time);
 			break;
+		}
 		/* must be S3 */
 		if (xramimage.datalen < 1) {
 			fprintf(stderr,
@@ -76,8 +81,10 @@
 				xramimage.filename, xramimage.lineno);
 			exit(1);
 		}
-		if (!rec_count)
+		if (!rec_count) {
 			printf("Each \'.\' is 100 S-records\n");
+			time(&start_time);
+		}
 		make_ml_arg(xramimage.record, srecarg);
 		tpinterf_make_cmd(argv);
 		if (tpinterf_send_cmd())
@@ -99,6 +106,10 @@
 		exit(1);
 	}
 	putchar('\n');	/* newline after the dots */
+	duration = finish_time - start_time;
+	mm = duration / 60;
+	ss = duration - mm * 60;
+	printf("XRAM image transferred in %um%us\n", mm, ss);
 	if (xram_run_baudrate != current_baud_rate) {
 		resp = loadagent_switch_baud(xram_run_baudrate);
 		if (resp)