@@ -128,6 +128,9 @@ AC_CHECK_MEMBER([struct CU_SuiteInfo.pSetUpFunc],
|
|||||||
#include <CUnit/TestDB.h>
|
#include <CUnit/TestDB.h>
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
AC_SEARCH_LIBS(clock_gettime, rt, [
|
||||||
|
AC_DEFINE([HAVE_CLOCK_GETTIME],1,[Define if clock_gettime is available])])
|
||||||
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile]
|
AC_CONFIG_FILES([Makefile]
|
||||||
[lib/Makefile]
|
[lib/Makefile]
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ test_preventallow_cold_reset(void)
|
|||||||
logging(LOG_VERBOSE, "Perform cold reset on target");
|
logging(LOG_VERBOSE, "Perform cold reset on target");
|
||||||
ret = iscsi_task_mgmt_target_cold_reset_sync(sd->iscsi_ctx);
|
ret = iscsi_task_mgmt_target_cold_reset_sync(sd->iscsi_ctx);
|
||||||
logging(LOG_VERBOSE, "Wait until all unit attentions clear");
|
logging(LOG_VERBOSE, "Wait until all unit attentions clear");
|
||||||
while (testunitready(sd, EXPECT_STATUS_GOOD) != 0);
|
while (testunitready(sd, EXPECT_STATUS_GOOD) != 0)
|
||||||
|
;
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ test_preventallow_lun_reset(void)
|
|||||||
ret = iscsi_task_mgmt_lun_reset_sync(sd->iscsi_ctx, sd->iscsi_lun);
|
ret = iscsi_task_mgmt_lun_reset_sync(sd->iscsi_ctx, sd->iscsi_lun);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "Wait until all unit attentions clear");
|
logging(LOG_VERBOSE, "Wait until all unit attentions clear");
|
||||||
while (testunitready(sd, EXPECT_STATUS_GOOD) != 0);
|
while (testunitready(sd, EXPECT_STATUS_GOOD) != 0)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Try to eject the medium");
|
logging(LOG_VERBOSE, "Try to eject the medium");
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ test_preventallow_warm_reset(void)
|
|||||||
ret = iscsi_task_mgmt_target_warm_reset_sync(sd->iscsi_ctx);
|
ret = iscsi_task_mgmt_target_warm_reset_sync(sd->iscsi_ctx);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
logging(LOG_VERBOSE, "Wait until all unit attentions clear");
|
logging(LOG_VERBOSE, "Wait until all unit attentions clear");
|
||||||
while (testunitready(sd, EXPECT_STATUS_GOOD) != 0);
|
while (testunitready(sd, EXPECT_STATUS_GOOD) != 0)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Try to eject the medium");
|
logging(LOG_VERBOSE, "Try to eject the medium");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
AM_CPPFLAGS=-I../include "-D_U_=__attribute__((unused))" \
|
AM_CPPFLAGS = -I../include "-D_U_=__attribute__((unused))" \
|
||||||
"-D_R_(A,B)=__attribute__((format(printf,A,B)))"
|
"-D_R_(A,B)=__attribute__((format(printf,A,B)))"
|
||||||
AM_CFLAGS=$(WARN_CFLAGS) -lrt
|
AM_CFLAGS = $(WARN_CFLAGS)
|
||||||
LDADD = ../lib/libiscsi.la
|
LDADD = ../lib/libiscsi.la
|
||||||
|
|
||||||
bin_PROGRAMS = iscsi-inq iscsi-ls iscsi-perf iscsi-readcapacity16 \
|
bin_PROGRAMS = iscsi-inq iscsi-ls iscsi-perf iscsi-readcapacity16 \
|
||||||
|
|||||||
@@ -27,6 +27,10 @@
|
|||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_CLOCK_GETTIME
|
||||||
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define VERSION "0.1"
|
#define VERSION "0.1"
|
||||||
|
|
||||||
const char *initiator = "iqn.2010-11.libiscsi:iscsi-perf";
|
const char *initiator = "iqn.2010-11.libiscsi:iscsi-perf";
|
||||||
@@ -55,12 +59,23 @@ struct client {
|
|||||||
};
|
};
|
||||||
|
|
||||||
u_int64_t get_clock_ns(void) {
|
u_int64_t get_clock_ns(void) {
|
||||||
struct timespec tp;
|
int res;
|
||||||
if (clock_gettime (CLOCK_MONOTONIC, &tp) == -1) {
|
u_int64_t ns;
|
||||||
fprintf(stderr,"could not get clock monotonic\n");
|
|
||||||
|
#ifdef HAVE_CLOCK_GETTIME
|
||||||
|
struct timespec ts;
|
||||||
|
res = clock_gettime (CLOCK_MONOTONIC, &tp);
|
||||||
|
ns = ts.tv_sec * 1000000000 + ts.tv_nsec;
|
||||||
|
#else
|
||||||
|
struct timeval tv;
|
||||||
|
res = gettimeofday(&tv, NULL);
|
||||||
|
ns = tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
|
||||||
|
#endif
|
||||||
|
if (res == -1) {
|
||||||
|
fprintf(stderr,"could not get requested clock\n");
|
||||||
exit(10);
|
exit(10);
|
||||||
}
|
}
|
||||||
return tp.tv_sec*1000000000+tp.tv_nsec;
|
return ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_read_queue(struct client *client);
|
void fill_read_queue(struct client *client);
|
||||||
@@ -76,12 +91,12 @@ void progress(struct client *client) {
|
|||||||
uint64_t aiops = 1000000000UL * (client->iops) / (now - client->first_ns);
|
uint64_t aiops = 1000000000UL * (client->iops) / (now - client->first_ns);
|
||||||
if (!_runtime) {
|
if (!_runtime) {
|
||||||
finished = 1;
|
finished = 1;
|
||||||
printf ("iops average %lu (%lu MB/s) ", aiops, (aiops * blocks_per_io * client->blocksize) >> 20);
|
printf ("iops average %llu (%llu MB/s) ", aiops, (aiops * blocks_per_io * client->blocksize) >> 20);
|
||||||
} else {
|
} else {
|
||||||
uint64_t iops = 1000000000UL * (client->iops - client->last_iops) / (now - client->last_ns);
|
uint64_t iops = 1000000000UL * (client->iops - client->last_iops) / (now - client->last_ns);
|
||||||
printf ("%02lu:%02lu:%02lu - ", (_runtime % 3600) / 60, _runtime / 60, _runtime % 60);
|
printf ("%02llu:%02llu:%02llu - ", (_runtime % 3600) / 60, _runtime / 60, _runtime % 60);
|
||||||
printf ("lba %lu, iops current %lu (%lu MB/s), ", client->pos, iops, (iops * blocks_per_io * client->blocksize) >> 20);
|
printf ("lba %llu, iops current %llu (%llu MB/s), ", client->pos, iops, (iops * blocks_per_io * client->blocksize) >> 20);
|
||||||
printf ("iops average %lu (%lu MB/s) ", aiops, (aiops * blocks_per_io * client->blocksize) >> 20);
|
printf ("iops average %llu (%llu MB/s) ", aiops, (aiops * blocks_per_io * client->blocksize) >> 20);
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
client->last_ns = now;
|
client->last_ns = now;
|
||||||
@@ -274,14 +289,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
|
|
||||||
printf("capacity is %lu blocks or %lu byte (%lu MB)\n", client.num_blocks, client.num_blocks * client.blocksize,
|
printf("capacity is %llu blocks or %llu byte (%llu MB)\n", client.num_blocks, client.num_blocks * client.blocksize,
|
||||||
(client.num_blocks * client.blocksize) >> 20);
|
(client.num_blocks * client.blocksize) >> 20);
|
||||||
|
|
||||||
printf("performing %s READ with %d parallel requests\nfixed transfer size of %d blocks (%d byte)\n",
|
printf("performing %s READ with %d parallel requests\nfixed transfer size of %d blocks (%d byte)\n",
|
||||||
client.random ? "random" : "sequential", max_in_flight, blocks_per_io, blocks_per_io * client.blocksize);
|
client.random ? "random" : "sequential", max_in_flight, blocks_per_io, blocks_per_io * client.blocksize);
|
||||||
|
|
||||||
if (runtime) {
|
if (runtime) {
|
||||||
printf("will run for %lu seconds.\n", runtime);
|
printf("will run for %llu seconds.\n", runtime);
|
||||||
} else {
|
} else {
|
||||||
printf("infinite runtime - press CTRL-C to abort.\n");
|
printf("infinite runtime - press CTRL-C to abort.\n");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user