changeset 610:98474043ecdd

fc-loadtool dump2file operations: added Rx time reporting
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 24 Feb 2020 19:32:43 +0000
parents ffd606adb039
children c847d742ab38
files loadtools/ltdump.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/loadtools/ltdump.c	Sat Feb 22 19:07:46 2020 +0000
+++ b/loadtools/ltdump.c	Mon Feb 24 19:32:43 2020 +0000
@@ -72,7 +72,7 @@
 static uint32_t dump_nextaddr, dump_crcaccum;
 static uint32_t dump_total_len, dump_progress_len;
 static u_char dump_binrec[0x86];
-static time_t dump_last_time;
+static time_t dump_initial_time, dump_last_time;
 
 static char dumpsrec_s0_line[] = "S007000044554D50C2\n";
 static char dumpsrec_s7_line[] = "S70500000000FA\n";
@@ -149,8 +149,14 @@
 {
 	u_long target_crc_init, target_crc_fin;
 	char *target_argv[4], target_arg1[10], target_arg2[10];
+	unsigned duration, mm, ss;
 	int stat;
 
+	if (!area_len) {
+		fprintf(stderr,
+			"error: dump of zero length is not supported\n");
+		return(-1);
+	}
 	if (start_addr & 0x7F || area_len & 0x7F) {
 		fprintf(stderr,
 		"error: implementation limit: 128-byte alignment required\n");
@@ -173,6 +179,7 @@
 	dump_progress_len = 0;
 
 	printf("Requesting memory dump...\n");
+	time(&dump_initial_time);
 	sprintf(target_arg1, "%lx", start_addr);
 	sprintf(target_arg2, "%lx", area_len);
 	target_argv[0] = "DUMP";
@@ -208,6 +215,11 @@
 	if (fmt_srec)
 		fputs(dumpsrec_s7_line, dump_outfile);
 	fclose(dump_outfile);
+	duration = dump_last_time - dump_initial_time;
+	mm = duration / 60;
+	ss = duration - mm * 60;
+	printf("Dump stream received in %um%us\n", mm, ss);
+
 	printf("Requesting another CRC-32 of the area from target...\n");
 	stat = crc32_on_target(start_addr, area_len, &target_crc_fin);
 	if (stat)