From bd381583de6bf3bbd884627d24b9ae751b6cfcf6 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 9 Jun 2013 16:31:28 +0000 Subject: [PATCH] Some polishing of SCSI log time measurement --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/spc.c | 2 +- libburn/util.c | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 0f94adc..9facdfa 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2013.06.09.154237" +#define Cdrskin_timestamP "2013.06.09.163052" diff --git a/libburn/spc.c b/libburn/spc.c index d7e57ca..6b2d79b 100644 --- a/libburn/spc.c +++ b/libburn/spc.c @@ -1676,7 +1676,7 @@ int scsi_log_reply(unsigned char *opcode, int data_dir, unsigned char *data, dxfer_len, fp, 0); } if (!(flag & 2)) - fprintf(fp, " %6.f us [ %.f ]\n", + fprintf(fp, " %8.f us [ %.f ]\n", duration * 1.0e6, (burn_get_time(0) - lib_start_time) * 1.0e6); if (burn_sg_log_scsi & 4) diff --git a/libburn/util.c b/libburn/util.c index e1af14f..ad7b77a 100644 --- a/libburn/util.c +++ b/libburn/util.c @@ -353,14 +353,22 @@ double burn_get_time(int flag) struct timeval tv; #ifdef Libburn_use_clock_gettime_monotoniC +#ifdef _POSIX_TIMERS #ifdef _POSIX_MONOTONIC_CLOCK + /* Enable by + export CFLAGS=-DLibburn_use_clock_gettime_monotoniC + export LIBS=-lrt + ./configure ... && make clean && make + */ + struct timespec tp; ret = clock_gettime(CLOCK_MONOTONIC, &tp); if (ret == 0) return ((double) tp.tv_sec) + ((double) tp.tv_nsec) * 1.0e-9; #endif /* _POSIX_MONOTONIC_CLOCK */ +#endif /* _POSIX_TIMERS */ #endif /* Xorriso_use_clock_gettime_monotoniC */ ret = gettimeofday(&tv, NULL);