iscsi-perf: Allow a better clock to be used
7c6a3e4a0b 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.
This commit is contained in:
+6
-3
@@ -14,6 +14,9 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -32,7 +35,7 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VERSION "0.1"
|
#define PERF_VERSION "0.1"
|
||||||
|
|
||||||
#define NOP_INTERVAL 5
|
#define NOP_INTERVAL 5
|
||||||
#define MAX_NOP_FAILURES 3
|
#define MAX_NOP_FAILURES 3
|
||||||
@@ -77,8 +80,8 @@ uint64_t get_clock_ns(void) {
|
|||||||
|
|
||||||
#ifdef HAVE_CLOCK_GETTIME
|
#ifdef HAVE_CLOCK_GETTIME
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
res = clock_gettime (CLOCK_MONOTONIC, &tp);
|
|
||||||
ns = ts.tv_sec * 1000000000 + ts.tv_nsec;
|
ns = ts.tv_sec * 1000000000 + ts.tv_nsec;
|
||||||
|
res = clock_gettime (CLOCK_MONOTONIC, &ts);
|
||||||
#else
|
#else
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
res = gettimeofday(&tv, NULL);
|
res = gettimeofday(&tv, NULL);
|
||||||
@@ -260,7 +263,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
printf("iscsi-perf version %s - (c) 2014-2015 by Peter Lieven <pl@ĸamp.de>\n\n", VERSION);
|
printf("iscsi-perf version %s - (c) 2014-2015 by Peter Lieven <pl@ĸamp.de>\n\n", PERF_VERSION);
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "i:m:b:t:nrRx:", long_options,
|
while ((c = getopt_long(argc, argv, "i:m:b:t:nrRx:", long_options,
|
||||||
&option_index)) != -1) {
|
&option_index)) != -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user