From 7ebe76cbc0bf64a033e9d978dd22cea3257e128b Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 10 Sep 2007 13:38:43 +0200 Subject: [PATCH] Slightly improved user interface of {asio,file}-test and renamed them to radix-*. --- debug/sorter/Makefile | 8 ++++---- debug/sorter/{asio-test.c => radix-asio-test.c} | 15 +++++++++++---- debug/sorter/{file-test.c => radix-file-test.c} | 17 ++++++++++++----- 3 files changed, 27 insertions(+), 13 deletions(-) rename debug/sorter/{asio-test.c => radix-asio-test.c} (91%) rename debug/sorter/{file-test.c => radix-file-test.c} (88%) diff --git a/debug/sorter/Makefile b/debug/sorter/Makefile index e5800213..93fa99cc 100644 --- a/debug/sorter/Makefile +++ b/debug/sorter/Makefile @@ -1,8 +1,8 @@ -# Testing the new sorter +# Tests related to the new sorter DIRS+=debug/sorter -PROGS+=$(addprefix $(o)/debug/sorter/,retros file-test asio-test) +PROGS+=$(addprefix $(o)/debug/sorter/,retros radix-file-test radix-asio-test) $(o)/debug/sorter/retros: $(o)/debug/sorter/retros.o $(LIBSH) -$(o)/debug/sorter/file-test: $(o)/debug/sorter/file-test.o $(LIBSH) -$(o)/debug/sorter/asio-test: $(o)/debug/sorter/asio-test.o $(LIBSH) +$(o)/debug/sorter/radix-file-test: $(o)/debug/sorter/radix-file-test.o $(LIBSH) +$(o)/debug/sorter/radix-asio-test: $(o)/debug/sorter/radix-asio-test.o $(LIBSH) diff --git a/debug/sorter/asio-test.c b/debug/sorter/radix-asio-test.c similarity index 91% rename from debug/sorter/asio-test.c rename to debug/sorter/radix-asio-test.c index 40df77b3..f2800f87 100644 --- a/debug/sorter/asio-test.c +++ b/debug/sorter/radix-asio-test.c @@ -3,6 +3,7 @@ */ #include "lib/lib.h" +#include "lib/conf.h" #include "lib/lfs.h" #include "lib/asio.h" @@ -32,10 +33,16 @@ static struct asio_queue io_queue; int main(int argc, char **argv) { - ASSERT(argc == 4); - uns files = atol(argv[1]); - uns bufsize = atol(argv[2]) * 1024; // Kbytes - u64 total_size = (u64)atol(argv[3]) * 1024*1024*1024; // Gbytes + uns files, bufsize; + u64 total_size; + if (argc != 4 || + cf_parse_int(argv[1], (int*) &files) || + cf_parse_int(argv[2], (int*) &bufsize) || + cf_parse_u64(argv[3], &total_size)) + { + fprintf(stderr, "Usage: asio-test \n"); + return 1; + } u64 cnt, cnt_rep; uns cnt_ms; int fd[files]; diff --git a/debug/sorter/file-test.c b/debug/sorter/radix-file-test.c similarity index 88% rename from debug/sorter/file-test.c rename to debug/sorter/radix-file-test.c index 430cb30c..b776d1ea 100644 --- a/debug/sorter/file-test.c +++ b/debug/sorter/radix-file-test.c @@ -3,6 +3,7 @@ */ #include "lib/lib.h" +#include "lib/conf.h" #include "lib/lfs.h" #include @@ -11,7 +12,7 @@ #include #define COPY -#define DIRECT O_DIRECT +#define DIRECT 0 // or O_DIRECT static timestamp_t timer; @@ -28,10 +29,16 @@ static timestamp_t timer; int main(int argc, char **argv) { - ASSERT(argc == 4); - uns files = atol(argv[1]); - uns bufsize = atol(argv[2]) * 1024; // Kbytes - u64 total_size = (u64)atol(argv[3]) * 1024*1024*1024; // Gbytes + uns files, bufsize; + u64 total_size; + if (argc != 4 || + cf_parse_int(argv[1], (int*) &files) || + cf_parse_int(argv[2], (int*) &bufsize) || + cf_parse_u64(argv[3], &total_size)) + { + fprintf(stderr, "Usage: file-test \n"); + return 1; + } u64 cnt, cnt_rep; uns cnt_ms; int fd[files]; -- 2.39.2