Blame SOURCES/kexec-tools-2.0.15-makedumpfile-Use-monotonic-clock-to-calculate-ETA-and-s.patch

26a7a5
From 0f4e25c5d7c031201fa7ad384cd9562b9c9c6004 Mon Sep 17 00:00:00 2001
26a7a5
From: Petr Tesarik <ptesarik@suse.com>
26a7a5
Date: Wed, 20 Jun 2018 11:50:18 +0200
26a7a5
Subject: [PATCH 1/2] [PATCH 1/2] Use monotonic clock to calculate ETA and
26a7a5
 stats
26a7a5
26a7a5
Execution time should be always measured by a monotonic clock,
26a7a5
because the system clock may be affected by discontinuous jumps,
26a7a5
e.g. when time is set manually by an admin.
26a7a5
26a7a5
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
26a7a5
---
26a7a5
 makedumpfile.c | 84 +++++++++++++++++++++++++++++-----------------------------
26a7a5
 print_info.c   | 30 +++++++++++----------
26a7a5
 print_info.h   |  6 ++---
26a7a5
 3 files changed, 61 insertions(+), 59 deletions(-)
26a7a5
26a7a5
diff --git a/makedumpfile-1.6.2/makedumpfile.c b/makedumpfile-1.6.2/makedumpfile.c
26a7a5
index 1ed3d61..abe7a2b 100644
26a7a5
--- a/makedumpfile-1.6.2/makedumpfile.c
26a7a5
+++ b/makedumpfile-1.6.2/makedumpfile.c
26a7a5
@@ -5364,7 +5364,7 @@ _exclude_free_page(struct cycle *cycle)
26a7a5
 {
26a7a5
 	int i, nr_zones, num_nodes, node;
26a7a5
 	unsigned long node_zones, zone, spanned_pages, pgdat;
26a7a5
-	struct timeval tv_start;
26a7a5
+	struct timespec ts_start;
26a7a5
 
26a7a5
 	if ((node = next_online_node(0)) < 0) {
26a7a5
 		ERRMSG("Can't get next online node.\n");
26a7a5
@@ -5374,7 +5374,7 @@ _exclude_free_page(struct cycle *cycle)
26a7a5
 		ERRMSG("Can't get pgdat list.\n");
26a7a5
 		return FALSE;
26a7a5
 	}
26a7a5
-	gettimeofday(&tv_start, NULL);
26a7a5
+	clock_gettime(CLOCK_MONOTONIC, &ts_start);
26a7a5
 
26a7a5
 	for (num_nodes = 1; num_nodes <= vt.numnodes; num_nodes++) {
26a7a5
 
26a7a5
@@ -5420,7 +5420,7 @@ _exclude_free_page(struct cycle *cycle)
26a7a5
 	 * print [100 %]
26a7a5
 	 */
26a7a5
 	print_progress(PROGRESS_FREE_PAGES, vt.numnodes, vt.numnodes, NULL);
26a7a5
-	print_execution_time(PROGRESS_FREE_PAGES, &tv_start);
26a7a5
+	print_execution_time(PROGRESS_FREE_PAGES, &ts_start);
26a7a5
 
26a7a5
 	return TRUE;
26a7a5
 }
26a7a5
@@ -5567,7 +5567,7 @@ create_1st_bitmap_file(void)
26a7a5
  	char buf[info->page_size];
26a7a5
 	mdf_pfn_t pfn, pfn_start, pfn_end, pfn_bitmap1;
26a7a5
 	unsigned long long phys_start, phys_end;
26a7a5
-	struct timeval tv_start;
26a7a5
+	struct timespec ts_start;
26a7a5
 	off_t offset_page;
26a7a5
 
26a7a5
 	if (info->flag_refiltering)
26a7a5
@@ -5597,7 +5597,7 @@ create_1st_bitmap_file(void)
26a7a5
 		offset_page += info->page_size;
26a7a5
 	}
26a7a5
 
26a7a5
-	gettimeofday(&tv_start, NULL);
26a7a5
+	clock_gettime(CLOCK_MONOTONIC, &ts_start);
26a7a5
 
26a7a5
 	/*
26a7a5
 	 * If page is on memory hole, set bit on the 1st-bitmap.
26a7a5
@@ -5629,7 +5629,7 @@ create_1st_bitmap_file(void)
26a7a5
 	 */
26a7a5
 	if (!info->flag_mem_usage) {
26a7a5
 		print_progress(PROGRESS_HOLES, info->max_mapnr, info->max_mapnr, NULL);
26a7a5
-		print_execution_time(PROGRESS_HOLES, &tv_start);
26a7a5
+		print_execution_time(PROGRESS_HOLES, &ts_start);
26a7a5
 	}
26a7a5
 
26a7a5
 	if (!sync_1st_bitmap())
26a7a5
@@ -5731,7 +5731,7 @@ create_bitmap_from_memhole(struct cycle *cycle, struct dump_bitmap *bitmap, int
26a7a5
 	mdf_pfn_t pfn_start_roundup, pfn_end_round;
26a7a5
 	unsigned long pfn_start_byte, pfn_end_byte;
26a7a5
 	unsigned int num_pt_loads = get_num_pt_loads();
26a7a5
-	struct timeval tv_start;
26a7a5
+	struct timespec ts_start;
26a7a5
 
26a7a5
 	/*
26a7a5
 	 * At first, clear all the bits on the bitmap.
26a7a5
@@ -5741,7 +5741,7 @@ create_bitmap_from_memhole(struct cycle *cycle, struct dump_bitmap *bitmap, int
26a7a5
 	/*
26a7a5
 	 * If page is on memory hole, set bit on the bitmap.
26a7a5
 	 */
26a7a5
-	gettimeofday(&tv_start, NULL);
26a7a5
+	clock_gettime(CLOCK_MONOTONIC, &ts_start);
26a7a5
 	for (i = 0; get_pt_load(i, &phys_start, &phys_end, NULL, NULL); i++) {
26a7a5
 		pfn_start = MAX(paddr_to_pfn(phys_start), cycle->start_pfn);
26a7a5
 		pfn_end = MIN(paddr_to_pfn(phys_end), cycle->end_pfn);
26a7a5
@@ -5786,7 +5786,7 @@ create_bitmap_from_memhole(struct cycle *cycle, struct dump_bitmap *bitmap, int
26a7a5
 	 * print 100 %
26a7a5
 	 */
26a7a5
 	print_progress(PROGRESS_HOLES, info->max_mapnr, info->max_mapnr, NULL);
26a7a5
-	print_execution_time(PROGRESS_HOLES, &tv_start);
26a7a5
+	print_execution_time(PROGRESS_HOLES, &ts_start);
26a7a5
 
26a7a5
 	return TRUE;
26a7a5
 }
26a7a5
@@ -6045,14 +6045,14 @@ exclude_unnecessary_pages(struct cycle *cycle)
26a7a5
 {
26a7a5
 	unsigned int mm;
26a7a5
 	struct mem_map_data *mmd;
26a7a5
-	struct timeval tv_start;
26a7a5
+	struct timespec ts_start;
26a7a5
 
26a7a5
 	if (is_xen_memory() && !info->dom0_mapnr) {
26a7a5
 		ERRMSG("Can't get max domain-0 PFN for excluding pages.\n");
26a7a5
 		return FALSE;
26a7a5
 	}
26a7a5
 
26a7a5
-	gettimeofday(&tv_start, NULL);
26a7a5
+	clock_gettime(CLOCK_MONOTONIC, &ts_start);
26a7a5
 
26a7a5
 	for (mm = 0; mm < info->num_mem_map; mm++) {
26a7a5
 
26a7a5
@@ -6076,7 +6076,7 @@ exclude_unnecessary_pages(struct cycle *cycle)
26a7a5
 	 */
26a7a5
 	if (!info->flag_mem_usage) {
26a7a5
 		print_progress(PROGRESS_UNN_PAGES, info->num_mem_map, info->num_mem_map, NULL);
26a7a5
-		print_execution_time(PROGRESS_UNN_PAGES, &tv_start);
26a7a5
+		print_execution_time(PROGRESS_UNN_PAGES, &ts_start);
26a7a5
 	}
26a7a5
 
26a7a5
 	return TRUE;
26a7a5
@@ -7474,7 +7474,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
26a7a5
 	unsigned long frac_head, frac_tail;
26a7a5
 	off_t off_seg_load, off_memory;
26a7a5
 	Elf64_Phdr load;
26a7a5
-	struct timeval tv_start;
26a7a5
+	struct timespec ts_start;
26a7a5
 	struct cycle cycle = {0};
26a7a5
 
26a7a5
 	if (!info->flag_elf_dumpfile)
26a7a5
@@ -7499,7 +7499,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
26a7a5
 	if (!(phnum = get_phnum_memory()))
26a7a5
 		return FALSE;
26a7a5
 
26a7a5
-	gettimeofday(&tv_start, NULL);
26a7a5
+	clock_gettime(CLOCK_MONOTONIC, &ts_start);
26a7a5
 
26a7a5
 	for (i = 0; i < phnum; i++) {
26a7a5
 		if (!get_phdr_memory(i, &load))
26a7a5
@@ -7547,7 +7547,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
26a7a5
 				}
26a7a5
 
26a7a5
 				if ((num_dumped % per) == 0)
26a7a5
-					print_progress(PROGRESS_COPY, num_dumped, num_dumpable, &tv_start);
26a7a5
+					print_progress(PROGRESS_COPY, num_dumped, num_dumpable, &ts_start);
26a7a5
 
26a7a5
 				num_dumped++;
26a7a5
 
26a7a5
@@ -7666,8 +7666,8 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
26a7a5
 	/*
26a7a5
 	 * print [100 %]
26a7a5
 	 */
26a7a5
-	print_progress(PROGRESS_COPY, num_dumpable, num_dumpable, &tv_start);
26a7a5
-	print_execution_time(PROGRESS_COPY, &tv_start);
26a7a5
+	print_progress(PROGRESS_COPY, num_dumpable, num_dumpable, &ts_start);
26a7a5
+	print_execution_time(PROGRESS_COPY, &ts_start);
26a7a5
 	PROGRESS_MSG("\n");
26a7a5
 
26a7a5
 	return TRUE;
26a7a5
@@ -8008,8 +8008,8 @@ write_kdump_pages_parallel_cyclic(struct cache_data *cd_header,
26a7a5
 	mdf_pfn_t per;
26a7a5
 	mdf_pfn_t start_pfn, end_pfn;
26a7a5
 	struct page_desc pd;
26a7a5
-	struct timeval tv_start;
26a7a5
-	struct timeval last, new;
26a7a5
+	struct timespec ts_start;
26a7a5
+	struct timespec last, new;
26a7a5
 	pthread_t **threads = NULL;
26a7a5
 	struct thread_args *kdump_thread_args = NULL;
26a7a5
 	void *thread_result;
26a7a5
@@ -8047,7 +8047,7 @@ write_kdump_pages_parallel_cyclic(struct cache_data *cd_header,
26a7a5
 	per = info->num_dumpable / 10000;
26a7a5
 	per = per ? per : 1;
26a7a5
 
26a7a5
-	gettimeofday(&tv_start, NULL);
26a7a5
+	clock_gettime(CLOCK_MONOTONIC, &ts_start);
26a7a5
 
26a7a5
 	start_pfn = cycle->start_pfn;
26a7a5
 	end_pfn   = cycle->end_pfn;
26a7a5
@@ -8095,7 +8095,7 @@ write_kdump_pages_parallel_cyclic(struct cache_data *cd_header,
26a7a5
 		 * The next pfn is smallest pfn in all page_flag_buf.
26a7a5
 		 */
26a7a5
 		sem_wait(&info->page_flag_buf_sem);
26a7a5
-		gettimeofday(&last, NULL);
26a7a5
+		clock_gettime(CLOCK_MONOTONIC, &last);
26a7a5
 		while (1) {
26a7a5
 			current_pfn = end_pfn;
26a7a5
 
26a7a5
@@ -8138,7 +8138,7 @@ write_kdump_pages_parallel_cyclic(struct cache_data *cd_header,
26a7a5
 			 * So we should recheck.
26a7a5
 			 */
26a7a5
 			if (info->page_flag_buf[consuming]->ready != FLAG_READY) {
26a7a5
-				gettimeofday(&new, NULL);
26a7a5
+				clock_gettime(CLOCK_MONOTONIC, &new;;
26a7a5
 				if (new.tv_sec - last.tv_sec > WAIT_TIME) {
26a7a5
 					ERRMSG("Can't get data of pfn.\n");
26a7a5
 					goto out;
26a7a5
@@ -8151,7 +8151,7 @@ write_kdump_pages_parallel_cyclic(struct cache_data *cd_header,
26a7a5
 		}
26a7a5
 
26a7a5
 		if ((num_dumped % per) == 0)
26a7a5
-			print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &tv_start);
26a7a5
+			print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &ts_start);
26a7a5
 
26a7a5
 		num_dumped++;
26a7a5
 
26a7a5
@@ -8187,8 +8187,8 @@ finish:
26a7a5
 	/*
26a7a5
 	 * print [100 %]
26a7a5
 	 */
26a7a5
-	print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &tv_start);
26a7a5
-	print_execution_time(PROGRESS_COPY, &tv_start);
26a7a5
+	print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &ts_start);
26a7a5
+	print_execution_time(PROGRESS_COPY, &ts_start);
26a7a5
 	PROGRESS_MSG("\n");
26a7a5
 
26a7a5
 out:
26a7a5
@@ -8238,7 +8238,7 @@ write_kdump_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_pag
26a7a5
 	struct page_desc pd;
26a7a5
 	unsigned char buf[info->page_size], *buf_out = NULL;
26a7a5
 	unsigned long len_buf_out;
26a7a5
-	struct timeval tv_start;
26a7a5
+	struct timespec ts_start;
26a7a5
 	const off_t failed = (off_t)-1;
26a7a5
 	unsigned long len_buf_out_zlib, len_buf_out_lzo, len_buf_out_snappy;
26a7a5
 
26a7a5
@@ -8299,12 +8299,12 @@ write_kdump_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_pag
26a7a5
 			end_pfn = info->split_end_pfn;
26a7a5
 	}
26a7a5
 
26a7a5
-	gettimeofday(&tv_start, NULL);
26a7a5
+	clock_gettime(CLOCK_MONOTONIC, &ts_start);
26a7a5
 
26a7a5
 	for (pfn = start_pfn; pfn < end_pfn; pfn++) {
26a7a5
 
26a7a5
 		if ((num_dumped % per) == 0)
26a7a5
-			print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &tv_start);
26a7a5
+			print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &ts_start);
26a7a5
 
26a7a5
 		/*
26a7a5
 		 * Check the excluded page.
26a7a5
@@ -8384,8 +8384,8 @@ out:
26a7a5
 		free(wrkmem);
26a7a5
 #endif
26a7a5
 
26a7a5
-	print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &tv_start);
26a7a5
-	print_execution_time(PROGRESS_COPY, &tv_start);
26a7a5
+	print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &ts_start);
26a7a5
+	print_execution_time(PROGRESS_COPY, &ts_start);
26a7a5
 
26a7a5
 	return ret;
26a7a5
 }
26a7a5
@@ -8747,7 +8747,7 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d
26a7a5
 	off_t offset_data=0;
26a7a5
 	struct disk_dump_header *dh = info->dump_header;
26a7a5
 	unsigned char buf[info->page_size];
26a7a5
-	struct timeval tv_start;
26a7a5
+	struct timespec ts_start;
26a7a5
 
26a7a5
 	cd_header->offset
26a7a5
 		= (DISKDUMP_HEADER_BLOCKS + dh->sub_hdr_size + dh->bitmap_blocks)
26a7a5
@@ -8829,7 +8829,7 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d
26a7a5
 	}
26a7a5
 	free_bitmap2_buffer();
26a7a5
 
26a7a5
-	gettimeofday(&tv_start, NULL);
26a7a5
+	clock_gettime(CLOCK_MONOTONIC, &ts_start);
26a7a5
 
26a7a5
 	/*
26a7a5
 	 * Write the remainder.
26a7a5
@@ -8842,8 +8842,8 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d
26a7a5
 	/*
26a7a5
 	 * print [100 %]
26a7a5
 	 */
26a7a5
-	print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &tv_start);
26a7a5
-	print_execution_time(PROGRESS_COPY, &tv_start);
26a7a5
+	print_progress(PROGRESS_COPY, num_dumped, info->num_dumpable, &ts_start);
26a7a5
+	print_execution_time(PROGRESS_COPY, &ts_start);
26a7a5
 	PROGRESS_MSG("\n");
26a7a5
 
26a7a5
 	return TRUE;
26a7a5
@@ -9563,10 +9563,10 @@ exclude_xen4_user_domain(void)
26a7a5
 int
26a7a5
 exclude_xen_user_domain(void)
26a7a5
 {
26a7a5
-	struct timeval tv_start;
26a7a5
+	struct timespec ts_start;
26a7a5
 	int ret;
26a7a5
 
26a7a5
-	gettimeofday(&tv_start, NULL);
26a7a5
+	clock_gettime(CLOCK_MONOTONIC, &ts_start);
26a7a5
 
26a7a5
 	if (info->xen_crash_info.com &&
26a7a5
 	    info->xen_crash_info.com->xen_major_version >= 4)
26a7a5
@@ -9578,7 +9578,7 @@ exclude_xen_user_domain(void)
26a7a5
 	 * print [100 %]
26a7a5
 	 */
26a7a5
 	print_progress(PROGRESS_XEN_DOMAIN, 1, 1, NULL);
26a7a5
-	print_execution_time(PROGRESS_XEN_DOMAIN, &tv_start);
26a7a5
+	print_execution_time(PROGRESS_XEN_DOMAIN, &ts_start);
26a7a5
 
26a7a5
 	return ret;
26a7a5
 }
26a7a5
@@ -10502,7 +10502,7 @@ reassemble_kdump_pages(void)
26a7a5
 	struct disk_dump_header dh;
26a7a5
 	struct page_desc pd, pd_zero;
26a7a5
 	struct cache_data cd_pd, cd_data;
26a7a5
-	struct timeval tv_start;
26a7a5
+	struct timespec ts_start;
26a7a5
 	char *data = NULL;
26a7a5
 	unsigned long data_buf_size = info->page_size;
26a7a5
 
26a7a5
@@ -10538,7 +10538,7 @@ reassemble_kdump_pages(void)
26a7a5
 	/*
26a7a5
 	 * Write page header of zero-filled page.
26a7a5
 	 */
26a7a5
-	gettimeofday(&tv_start, NULL);
26a7a5
+	clock_gettime(CLOCK_MONOTONIC, &ts_start);
26a7a5
 	if (info->dump_level & DL_EXCLUDE_ZERO) {
26a7a5
 		/*
26a7a5
 		 * makedumpfile outputs the data of zero-filled page at first
26a7a5
@@ -10573,7 +10573,7 @@ reassemble_kdump_pages(void)
26a7a5
 
26a7a5
 			num_dumped++;
26a7a5
 
26a7a5
-			print_progress(PROGRESS_COPY, num_dumped, num_dumpable, &tv_start);
26a7a5
+			print_progress(PROGRESS_COPY, num_dumped, num_dumpable, &ts_start);
26a7a5
 
26a7a5
 			if (lseek(fd, offset_ph_org, SEEK_SET) < 0) {
26a7a5
 				ERRMSG("Can't seek a file(%s). %s\n",
26a7a5
@@ -10670,8 +10670,8 @@ reassemble_kdump_pages(void)
26a7a5
 						    size_eraseinfo))
26a7a5
 			goto out;
26a7a5
 	}
26a7a5
-	print_progress(PROGRESS_COPY, num_dumpable, num_dumpable, &tv_start);
26a7a5
-	print_execution_time(PROGRESS_COPY, &tv_start);
26a7a5
+	print_progress(PROGRESS_COPY, num_dumpable, num_dumpable, &ts_start);
26a7a5
+	print_execution_time(PROGRESS_COPY, &ts_start);
26a7a5
 
26a7a5
 	ret = TRUE;
26a7a5
 out:
26a7a5
diff --git a/makedumpfile-1.6.2/print_info.c b/makedumpfile-1.6.2/print_info.c
26a7a5
index 6bfcd11..732d5b8 100644
26a7a5
--- a/makedumpfile-1.6.2/print_info.c
26a7a5
+++ b/makedumpfile-1.6.2/print_info.c
26a7a5
@@ -19,6 +19,8 @@
26a7a5
 
26a7a5
 #define PROGRESS_MAXLEN		"50"
26a7a5
 
26a7a5
+#define NSEC_PER_SEC		1000000000L
26a7a5
+
26a7a5
 int message_level;
26a7a5
 int flag_strerr_message;
26a7a5
 int flag_ignore_r_char; /* 0: '\r' is effective. 1: not effective. */
26a7a5
@@ -338,16 +340,16 @@ print_usage(void)
26a7a5
 	MSG("\n");
26a7a5
 }
26a7a5
 
26a7a5
-static void calc_delta(struct timeval *tv_start, struct timeval *delta)
26a7a5
+static void calc_delta(struct timespec *ts_start, struct timespec *delta)
26a7a5
 {
26a7a5
-	struct timeval tv_end;
26a7a5
+	struct timespec ts_end;
26a7a5
 
26a7a5
-	gettimeofday(&tv_end, NULL);
26a7a5
-	delta->tv_sec = tv_end.tv_sec - tv_start->tv_sec;
26a7a5
-	delta->tv_usec = tv_end.tv_usec - tv_start->tv_usec;
26a7a5
-	if (delta->tv_usec < 0) {
26a7a5
+	clock_gettime(CLOCK_MONOTONIC, &ts_end);
26a7a5
+	delta->tv_sec = ts_end.tv_sec - ts_start->tv_sec;
26a7a5
+	delta->tv_nsec = ts_end.tv_nsec - ts_start->tv_nsec;
26a7a5
+	if (delta->tv_nsec < 0) {
26a7a5
 		delta->tv_sec--;
26a7a5
-		delta->tv_usec += 1000000;
26a7a5
+		delta->tv_nsec += NSEC_PER_SEC;
26a7a5
 	}
26a7a5
 }
26a7a5
 
26a7a5
@@ -371,14 +373,14 @@ static int eta_to_human_short (unsigned long secs, char* msg)
26a7a5
 
26a7a5
 
26a7a5
 void
26a7a5
-print_progress(const char *msg, unsigned long current, unsigned long end, struct timeval *start)
26a7a5
+print_progress(const char *msg, unsigned long current, unsigned long end, struct timespec *start)
26a7a5
 {
26a7a5
 	unsigned progress;	/* in promilles (tenths of a percent) */
26a7a5
 	time_t tm;
26a7a5
 	static time_t last_time = 0;
26a7a5
 	static unsigned int lapse = 0;
26a7a5
 	static const char *spinner = "/|\\-";
26a7a5
-	struct timeval delta;
26a7a5
+	struct timespec delta;
26a7a5
 	unsigned long eta;
26a7a5
 	char eta_msg[16] = " ";
26a7a5
 
26a7a5
@@ -393,7 +395,7 @@ print_progress(const char *msg, unsigned long current, unsigned long end, struct
26a7a5
 
26a7a5
 	if (start != NULL && progress != 0) {
26a7a5
 		calc_delta(start, &delta);
26a7a5
-		eta = 1000 * delta.tv_sec + delta.tv_usec / 1000;
26a7a5
+		eta = 1000 * delta.tv_sec + delta.tv_nsec / (NSEC_PER_SEC / 1000);
26a7a5
 		eta = eta / progress - delta.tv_sec;
26a7a5
 		eta_to_human_short(eta, eta_msg);
26a7a5
 	}
26a7a5
@@ -411,12 +413,12 @@ print_progress(const char *msg, unsigned long current, unsigned long end, struct
26a7a5
 }
26a7a5
 
26a7a5
 void
26a7a5
-print_execution_time(char *step_name, struct timeval *tv_start)
26a7a5
+print_execution_time(char *step_name, struct timespec *ts_start)
26a7a5
 {
26a7a5
-	struct timeval delta;
26a7a5
+	struct timespec delta;
26a7a5
 
26a7a5
-	calc_delta(tv_start, &delta);
26a7a5
+	calc_delta(ts_start, &delta);
26a7a5
 	REPORT_MSG("STEP [%s] : %ld.%06ld seconds\n",
26a7a5
-		   step_name, delta.tv_sec, delta.tv_usec);
26a7a5
+		   step_name, delta.tv_sec, delta.tv_nsec / 1000);
26a7a5
 }
26a7a5
 
26a7a5
diff --git a/makedumpfile-1.6.2/print_info.h b/makedumpfile-1.6.2/print_info.h
26a7a5
index 1ce3593..49b70f4 100644
26a7a5
--- a/makedumpfile-1.6.2/print_info.h
26a7a5
+++ b/makedumpfile-1.6.2/print_info.h
26a7a5
@@ -17,7 +17,7 @@
26a7a5
 #define _PRINT_INFO_H
26a7a5
 
26a7a5
 #include <stdio.h>
26a7a5
-#include <sys/time.h>
26a7a5
+#include <time.h>
26a7a5
 
26a7a5
 extern int message_level;
26a7a5
 extern int flag_strerr_message;
26a7a5
@@ -25,9 +25,9 @@ extern int flag_ignore_r_char;
26a7a5
 
26a7a5
 void show_version(void);
26a7a5
 void print_usage(void);
26a7a5
-void print_progress(const char *msg, unsigned long current, unsigned long end, struct timeval *start);
26a7a5
+void print_progress(const char *msg, unsigned long current, unsigned long end, struct timespec *start);
26a7a5
 
26a7a5
-void print_execution_time(char *step_name, struct timeval *tv_start);
26a7a5
+void print_execution_time(char *step_name, struct timespec *ts_start);
26a7a5
 
26a7a5
 /*
26a7a5
  * Message texts
26a7a5
-- 
26a7a5
2.9.5
26a7a5