Skip to content

Commit

Permalink
bench: check number of iterations
Browse files Browse the repository at this point in the history
Ref: #14
  • Loading branch information
ldorau committed Mar 30, 2017
1 parent 66ea4bc commit 3b3b8d9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions utils/file_sc_bench.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016, Intel Corporation
* Copyright 2016-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -70,11 +70,12 @@ open_close()
static void
loop_tx(char *name, tx_t tx_f, uint64_t qty, FILE *f)
{
uint64_t i;

uint64_t tu_start, tu_end, delta;
uint64_t i, tu_start, tu_end, delta;
struct timeval tv_start, tv_end;

if (qty == 0)
return;

gettimeofday(&tv_start, NULL);

for (i = 0; i < qty; i++)
Expand Down Expand Up @@ -103,11 +104,16 @@ main(int argc, char *argv[])
uint64_t iters_qty;

if (argc != 2) {
printf("usage: %s iters qty\n", argv[0]);
printf("Usage: %s <number-of-iterations>\n", argv[0]);
printf("\t <number-of-iterations> must be greater than 0\n");
return 1;
}

iters_qty = atol(argv[1]);
if (iters_qty == 0) {
printf("Error: number of iterations must be greater than 0\n");
return 1;
}

/* WARM-UP */
loop_tx("open_read_write_close",
Expand Down

0 comments on commit 3b3b8d9

Please sign in to comment.