From 831b222917fd6cabdedf7aa40c0b928db0d6673e Mon Sep 17 00:00:00 2001 From: Sitsofe Wheeler Date: Sat, 30 Jan 2016 08:21:21 +0000 Subject: [PATCH] iscsi-perf: Allow a better clock to be used 7c6a3e4a0b86582bc68a6df0446592f156e86240 wound up always forcing the usage of gettimeofday (even when the more accurate CLOCK_MONOTONIC was available) because the define to indicate its availability is in config.h which wasn't included. Fix this by including config.h, correct the misnamed variable in the CLOCK_MONOTONIC branch and rename VERSION to PERF_VERSION to avoid the naming conflict. --- utils/iscsi-perf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utils/iscsi-perf.c b/utils/iscsi-perf.c index a27d50a..f09802c 100644 --- a/utils/iscsi-perf.c +++ b/utils/iscsi-perf.c @@ -14,6 +14,9 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include @@ -32,7 +35,7 @@ #include #endif -#define VERSION "0.1" +#define PERF_VERSION "0.1" #define NOP_INTERVAL 5 #define MAX_NOP_FAILURES 3 @@ -77,8 +80,8 @@ uint64_t get_clock_ns(void) { #ifdef HAVE_CLOCK_GETTIME struct timespec ts; - res = clock_gettime (CLOCK_MONOTONIC, &tp); ns = ts.tv_sec * 1000000000 + ts.tv_nsec; + res = clock_gettime (CLOCK_MONOTONIC, &ts); #else struct timeval tv; res = gettimeofday(&tv, NULL); @@ -260,7 +263,7 @@ int main(int argc, char *argv[]) srand(time(NULL)); - printf("iscsi-perf version %s - (c) 2014-2015 by Peter Lieven \n\n", VERSION); + printf("iscsi-perf version %s - (c) 2014-2015 by Peter Lieven \n\n", PERF_VERSION); while ((c = getopt_long(argc, argv, "i:m:b:t:nrRx:", long_options, &option_index)) != -1) {